class JSON::SchemaBuilder::RSpecHelper::DeepOpenStruct
Public Class Methods
new(hash = { })
click to toggle source
# File lib/json/schema_builder/rspec_helper/deep_open_struct.rb, line 5 def initialize(hash = { }) @table = { } hash.each_pair do |key, value| key = key.to_sym @table[key] = _transform value new_ostruct_member key end end
Public Instance Methods
==(other)
click to toggle source
# File lib/json/schema_builder/rspec_helper/deep_open_struct.rb, line 14 def ==(other) to_h == other.to_h end
Also aliased as: eql?
inspect()
click to toggle source
# File lib/json/schema_builder/rspec_helper/deep_open_struct.rb, line 19 def inspect to_h.inspect end
Private Instance Methods
_transform(object)
click to toggle source
# File lib/json/schema_builder/rspec_helper/deep_open_struct.rb, line 25 def _transform(object) case object when Hash DeepOpenStruct.new object when Array object.map{ |item| _transform item } else object end end