File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,10 @@ describe "JSON serialization" do
37
37
Path .from_json(%( "foo/bar") ).should eq(Path .new(" foo/bar" ))
38
38
end
39
39
40
+ it " does Path.from_json_object_key" do
41
+ Hash (Path , String ).from_json(%( {"foo/bar": "baz"}) ).should eq({Path .new(" foo/bar" ) => " baz" })
42
+ end
43
+
40
44
{% for int in BUILTIN_INTEGER_TYPES % }
41
45
it " does {{ int }}.from_json" do
42
46
{{ int }}.from_json(" 0" ).should(be_a({{ int }})).should eq(0 )
Original file line number Diff line number Diff line change @@ -199,6 +199,10 @@ def String.from_json_object_key?(key : String) : String
199
199
key
200
200
end
201
201
202
+ def Path.from_json_object_key ?(key : String ) : Path
203
+ new(key)
204
+ end
205
+
202
206
def Array.new (pull : JSON ::PullParser )
203
207
ary = new
204
208
new(pull) do |element |
You can’t perform that action at this time.
0 commit comments