File tree 2 files changed +9
-4
lines changed
2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,11 @@ describe "YAML serialization" do
46
46
Array (Int32 ).from_yaml(" ---\n - 1\n - 2\n - 3\n " ).should eq([1 , 2 , 3 ])
47
47
end
48
48
49
+ it " does Array#from_yaml from IO" do
50
+ io = IO ::Memory .new " ---\n - 1\n - 2\n - 3\n "
51
+ Array (Int32 ).from_yaml(io).should eq([1 , 2 , 3 ])
52
+ end
53
+
49
54
it " does Array#from_yaml with block" do
50
55
elements = [] of Int32
51
56
Array (Int32 ).from_yaml(" ---\n - 1\n - 2\n - 3\n " ) do |element |
Original file line number Diff line number Diff line change 1
- def Object.from_yaml (string : String ) : self
2
- YAML ::PullParser .new(string ) do |parser |
1
+ def Object.from_yaml (string_or_io ) : self
2
+ YAML ::PullParser .new(string_or_io ) do |parser |
3
3
parser.read_stream do
4
4
parser.read_document do
5
5
new parser
@@ -8,8 +8,8 @@ def Object.from_yaml(string : String) : self
8
8
end
9
9
end
10
10
11
- def Array.from_yaml (string : String )
12
- YAML ::PullParser .new(string ) do |parser |
11
+ def Array.from_yaml (string_or_io )
12
+ YAML ::PullParser .new(string_or_io ) do |parser |
13
13
parser.read_stream do
14
14
parser.read_document do
15
15
new(parser) do |element |
You can’t perform that action at this time.
0 commit comments