File tree Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -31,30 +31,26 @@ def http
3131 # Takes JSON and converts it into a OpenStruct representation. This method
3232 # is recursive so it's somewhat hard to tell what's going on sometimes...
3333 def process ( json )
34-
3534 # If the current json is an array then we need to loop through each
3635 # element and process it and add it to the newly created array
3736
3837 if json . is_a? Array
39- result = json . map do |element |
38+ json . map do |element |
4039 process ( element )
4140 end
4241
4342 # If the current json is a hash then we need to created a new hash by
4443 # looping over each of it's keys and processing the values
4544
4645 elsif json . is_a? Hash
47- json = Hash [ json . map { |key , value | [ key , process ( value ) ] } ]
48- result = OpenStruct . new ( json )
46+ OpenStruct . new ( Hash [ json . map { |key , value | [ key , process ( value ) ] } ] )
4947
5048 # The current json is some kind of primitive so there's nothing to do in
5149 # this case so we'll just return it
5250
5351 else
54- result = json
52+ json
5553 end
56-
57- result
5854 end
5955
6056 def path_with_params ( path , params )
You can’t perform that action at this time.
0 commit comments