Merge: Each line
authorJean Privat <jean@pryen.org>
Wed, 17 Dec 2014 04:54:21 +0000 (23:54 -0500)
committerJean Privat <jean@pryen.org>
Wed, 17 Dec 2014 04:54:21 +0000 (23:54 -0500)
commit8f4c9c1a4596bb305c87712e8b443cde97260930
tree232a8f59ca8847edab073fcbf29da45230a3d514
parenta83887f46ab4557c5abca3fab4d943fb9fc05457
parent31419179f461e03d834a9216cdac1f47513103b6
Merge: Each line

Improve IStream and Path for easiness of reading.

First, add new iterator `each_line` that lazily `read_line` of a stream.

Second, wrap some reading methods on `Path` so that the input of data from files is really easy.

~~~nit
var content = "/etc/issue".to_path.read_all
print content
~~~

and

~~~nit
for l in "/etc/passwd".to_path.each_line do
   var fields = l.split(":")
   print "name={fields[0]} uid={fields[2]}"
end
~~~

TODO: better error management

Pull-Request: #1033
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>