Merge: Bytes is now Writable
authorJean Privat <jean@pryen.org>
Mon, 28 Sep 2015 14:36:07 +0000 (10:36 -0400)
committerJean Privat <jean@pryen.org>
Mon, 28 Sep 2015 14:36:07 +0000 (10:36 -0400)
As @xymus requested, `Bytes` is now a subclass of `Writable`

Pull-Request: #1738
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/core/stream.nit

index b4a0e2b..e097f9b 100644 (file)
@@ -425,6 +425,13 @@ interface Writable
        end
 end
 
+redef class Bytes
+       super Writable
+       redef fun write_to(s) do s.write_bytes(self)
+
+       redef fun write_to_string do return to_s
+end
+
 redef class Text
        super Writable
        redef fun write_to(stream) do stream.write(self)