Skip to content

Commit

Permalink
Fixed json_create example to use create_additions = true
Browse files Browse the repository at this point in the history
The example doesn't work OOTB, since this flag is _not enabled_ by default.

(Even with this change in place, I cannot get additions to work with the `Range` class. For custom objects it works though, I tested with the example from the `json_addition_test.rb` - that's where I got the working approach.)
  • Loading branch information
perlun committed May 31, 2017
1 parent 4688035 commit 4c3fa82
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -212,7 +212,7 @@ Now it possible to serialise/deserialise ranges as well:
```ruby
json = JSON.generate [1, 2, {"a"=>3.141}, false, true, nil, 4..10]
# => "[1,2,{\"a\":3.141},false,true,null,{\"json_class\":\"Range\",\"data\":[4,10,false]}]"
JSON.parse json
JSON.parse json, :create_additions => true
# => [1, 2, {"a"=>3.141}, false, true, nil, 4..10]
```

Expand Down

0 comments on commit 4c3fa82

Please sign in to comment.