You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

14 lines
235 B

require 'ostruct'
class OpenStruct
def self.deep(value)
case value
when Hash
self.new value.collect { |k, v| [k, self.deep(v)] }.to_h
when Enumerable
value.collect { |v| self.deep v }
else
value
end
end
end