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
123123 # Otherwise, calls JSON.generate with +object+ and +opts+ (see method #generate):
124124 # ruby = [0, 1, nil]
125125 # JSON[ruby] # => '[0,1,null]'
126- def []( object , opts = { } )
126+ def []( object , opts = nil )
127127 if object . is_a? ( String )
128128 return JSON . parse ( object , opts )
129129 elsif object . respond_to? ( :to_str )
@@ -1038,16 +1038,7 @@ def jj(*objs)
10381038 #
10391039 # The _opts_ argument is passed through to generate/parse respectively. See
10401040 # 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 ]
10521043 end
10531044end
You can’t perform that action at this time.
0 commit comments