Filename.st
branchjv
changeset 20205 03e626304d06
parent 20083 196706395bbc
parent 20158 2e4c6347ef0b
child 20342 219a5a47e8b1
--- a/Filename.st	Fri Jul 29 21:39:49 2016 +0100
+++ b/Filename.st	Fri Jul 29 21:40:03 2016 +0100
@@ -1688,8 +1688,8 @@
 !
 
 readingFile:aPathName do:aBlock
-    "create a read-stream on a file, evaluate aBlock, passing that stream,
-     and return the blocks value.
+    "Create a read stream on a file, evaluate aBlock, passing that stream,
+     and return the block's value.
      Ensures that the stream is closed."
 
     ^ aPathName asFilename readingFileDo:aBlock.
@@ -1700,11 +1700,11 @@
      |rslt|
 
      rslt :=
-	Filename
-	    readingFile:'/etc/passwd'
-	    do:[:s |
-		s nextLine
-	    ].
+        Filename
+            readingFile:'/etc/passwd'
+            do:[:s |
+                s nextLine
+            ].
      Transcript showCR:rslt.
     "
 
@@ -1714,22 +1714,22 @@
      |rslt|
 
      rslt :=
-	Filename
-	    readingFile:'/etc/passwd'
-	    do:
-		[:s |
-		    |shells|
-
-		    shells := Bag new.
-		    s linesDo:
-			[:line |
-			    |parts|
-
-			    parts := line asCollectionOfSubstringsSeparatedBy:$:.
-			    shells add:(parts seventh).
-			].
-		    shells contents
-		].
+        Filename
+            readingFile:'/etc/passwd'
+            do:
+                [:s |
+                    |shells|
+
+                    shells := Bag new.
+                    s linesDo:
+                        [:line |
+                            |parts|
+
+                            parts := line asCollectionOfSubstringsSeparatedBy:$:.
+                            shells add:(parts seventh).
+                        ].
+                    shells contents
+                ].
      Transcript showCR:rslt.
     "
 ! !
@@ -2775,13 +2775,13 @@
 !
 
 readStream
-    "return a stream for reading from the file represented by the receiver.
+    "Return a stream for reading from the file represented by the receiver.
      Raises an error if the file does not exist."
 
     ^ FileStream readonlyFileNamed:(self osNameForAccess)
 
     "
-      '/tmp/foo' asFilename readStream.
+      '/tmp/foo' asFilename readStream
     "
 !
 
@@ -5895,8 +5895,8 @@
 !
 
 contents
-    "return the contents of the file as a collection of lines;
-     Raises an error, if the file is unreadable/non-existing.
+    "Return the contents of the file as a collection of lines.
+     Raise an error if the file is unreadable/non-existing.
      See also #contentsOfEntireFile, which returns a string for textFiles.
      CAVEAT: bad naming - but req'd for VW compatibility."
 
@@ -5946,8 +5946,8 @@
 !
 
 readingFileDo:aBlock
-    "create a read-stream on the receiver file, evaluate aBlock, passing that stream as arg,
-     and return the blocks value.
+    "Create a read stream on the receiver file, evaluate aBlock, passing that stream as arg,
+     and return the block's value.
      If the file cannot be opened, an exception is raised or
      (old behavior, will vanish:)the block is evaluated with a nil argument.
      Ensures that the stream is closed."
@@ -5956,9 +5956,9 @@
 
     stream := self readStream.
     [
-	result := aBlock value:stream
+        result := aBlock value:stream
     ] ensure:[
-	stream notNil ifTrue:[stream close]
+        stream notNil ifTrue:[stream close]
     ].
     ^ result
 
@@ -5968,10 +5968,10 @@
      |rslt|
 
      rslt :=
-	'/etc/passwd' asFilename
-	    readingFileDo:[:s |
-		s nextLine
-	    ].
+        '/etc/passwd' asFilename
+            readingFileDo:[:s |
+                s nextLine
+            ].
      Transcript showCR:rslt.
     "
 
@@ -5981,47 +5981,47 @@
      |rslt|
 
      rslt :=
-	'/etc/passwd' asFilename
-	    readingFileDo:
-		[:s |
-		    |shells|
-
-		    shells := Bag new.
-		    s linesDo:
-			[:line |
-			    |parts|
-
-			    parts := line asCollectionOfSubstringsSeparatedBy:$:.
-			    shells add:(parts seventh).
-			].
-		    shells contents
-		].
+        '/etc/passwd' asFilename
+            readingFileDo:
+                [:s |
+                    |shells|
+
+                    shells := Bag new.
+                    s linesDo:
+                        [:line |
+                            |parts|
+
+                            parts := line asCollectionOfSubstringsSeparatedBy:$:.
+                            shells add:(parts seventh).
+                        ].
+                    shells contents
+                ].
      Transcript showCR:rslt.
     "
 !
 
 readingLinesDo:aBlock
-    "create a read-stream on the receiver file,
+    "Create a read stream on the receiver file and
      evaluate aBlock for each line read from the stream.
      If the file cannot be opened, an error is raised.
      Ensures that the stream is closed."
 
     self readingFileDo:[:stream |
-	stream linesDo:aBlock
+        stream linesDo:aBlock
     ].
 
     "
     '/etc/passwd' asFilename
-	readingLinesDo:[:eachLine |
-	    Transcript showCR:eachLine.
-	].
+        readingLinesDo:[:eachLine |
+            Transcript showCR:eachLine.
+        ].
     "
 
     "
     '/etc/xxxxx' asFilename
-	readingLinesDo:[:eachLine |
-	    Transcript showCR:eachLine.
-	].
+        readingLinesDo:[:eachLine |
+            Transcript showCR:eachLine.
+        ].
     "
 ! !