Class: JSON::SchemaBuilder::RSpecHelper::DeepOpenStruct

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/json/schema_builder/rspec_helper/deep_open_struct.rb

Instance Method Summary collapse

Constructor Details

#initialize(hash = { }) ⇒ DeepOpenStruct

Returns a new instance of DeepOpenStruct.



5
6
7
8
9
10
11
12
# 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

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



14
15
16
# File 'lib/json/schema_builder/rspec_helper/deep_open_struct.rb', line 14

def ==(other)
  to_h == other.to_h
end

#inspectObject



19
20
21
# File 'lib/json/schema_builder/rspec_helper/deep_open_struct.rb', line 19

def inspect
  to_h.inspect
end