nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bd435f3
)
lib: implement `close` in StringOStream
author
Alexis Laferrière
<alexis.laf@xymus.net>
Mon, 16 Jun 2014 16:03:48 +0000
(12:03 -0400)
committer
Alexis Laferrière
<alexis.laf@xymus.net>
Tue, 17 Jun 2014 18:53:20 +0000
(14:53 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
lib/standard/stream.nit
patch
|
blob
|
history
diff --git
a/lib/standard/stream.nit
b/lib/standard/stream.nit
index
79e601f
..
a94601c
100644
(file)
--- a/
lib/standard/stream.nit
+++ b/
lib/standard/stream.nit
@@
-419,6
+419,13
@@
class StringOStream
private var content = new Array[String]
redef fun to_s do return content.to_s
- redef fun is_writable do return true
- redef fun write(str) do content.add(str.to_s)
+ redef fun is_writable do return not closed
+ redef fun write(str)
+ do
+ assert not closed
+ content.add(str.to_s)
+ end
+
+ protected var closed = false
+ redef fun close do closed = true
end