class OpConnect::Object
Public Class Methods
new(attributes)
click to toggle source
Calls superclass method
# File lib/op_connect/object.rb, line 5 def initialize(attributes) super to_ostruct(attributes) end
Private Instance Methods
to_ostruct(obj)
click to toggle source
# File lib/op_connect/object.rb, line 11 def to_ostruct(obj) if obj.is_a?(Hash) OpenStruct.new(obj.map { |key, value| [key, to_ostruct(value)] }.to_h) elsif obj.is_a?(Array) obj.map { |o| to_ostruct(o) } else obj end end