File tree Expand file tree Collapse file tree 1 file changed +3
-12
lines changed Expand file tree Collapse file tree 1 file changed +3
-12
lines changed Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ class << self
123
123
# Otherwise, calls JSON.generate with +object+ and +opts+ (see method #generate):
124
124
# ruby = [0, 1, nil]
125
125
# JSON[ruby] # => '[0,1,null]'
126
- def []( object , opts = { } )
126
+ def []( object , opts = nil )
127
127
if object . is_a? ( String )
128
128
return JSON . parse ( object , opts )
129
129
elsif object . respond_to? ( :to_str )
@@ -1038,16 +1038,7 @@ def jj(*objs)
1038
1038
#
1039
1039
# The _opts_ argument is passed through to generate/parse respectively. See
1040
1040
# generate and parse for their documentation.
1041
- def JSON ( object , *args )
1042
- if object . is_a? ( String )
1043
- return JSON . parse ( object , args . first )
1044
- elsif object . respond_to? ( :to_str )
1045
- str = object . to_str
1046
- if str . is_a? ( String )
1047
- return JSON . parse ( object . to_str , args . first )
1048
- end
1049
- end
1050
-
1051
- JSON . generate ( object , args . first )
1041
+ def JSON ( object , opts = nil )
1042
+ JSON [ object , opts ]
1052
1043
end
1053
1044
end
You can’t perform that action at this time.
0 commit comments