stdlib/streams: Streamable now working on any Text type instead of just String.
authorLucas Bajolet <r4pass@hotmail.com>
Mon, 7 Apr 2014 16:09:30 +0000 (12:09 -0400)
committerLucas Bajolet <r4pass@hotmail.com>
Tue, 8 Apr 2014 21:22:06 +0000 (17:22 -0400)
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

lib/filter_stream.nit
lib/standard/stream.nit
src/network_debugger.nit

index 5286c7c..a32c288 100644 (file)
@@ -116,7 +116,7 @@ class StreamDemux
                end
        end
 
-       redef fun write(s: String)
+       redef fun write(s: Text)
        do
                for i in _streams
                do
index d65d377..932919b 100644 (file)
@@ -92,7 +92,7 @@ end
 interface OStream
        super IOS
        # write a string
-       fun write(s: String) is abstract
+       fun write(s: Text) is abstract
 
        # Can the stream be used to write
        fun is_writable: Bool is abstract
@@ -122,7 +122,7 @@ interface Streamable
        end
 end
 
-redef class String
+redef class Text
        super Streamable
        redef fun write_to(stream) do stream.write(self)
 end
@@ -391,5 +391,5 @@ 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)
+       redef fun write(str) do content.add(str.to_s)
 end
index 7fc38aa..e8afc20 100644 (file)
@@ -222,7 +222,7 @@ redef class Stdout
        redef fun write(s)
        do
                if connection != null then
-                       connection.write(s)
+                       connection.write(s.to_s)
                else
                        super
                end