Class: Conformist::HashStruct

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/conformist/hash_struct.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ HashStruct

Returns a new instance of HashStruct.



9
10
11
# File 'lib/conformist/hash_struct.rb', line 9

def initialize attributes = {}
  self.attributes = attributes
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object (protected)



23
24
25
# File 'lib/conformist/hash_struct.rb', line 23

def method_missing method, *args, &block
  fetch(method) { super }
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



5
6
7
# File 'lib/conformist/hash_struct.rb', line 5

def attributes
  @attributes
end

Instance Method Details

#==(other) ⇒ Object



13
14
15
# File 'lib/conformist/hash_struct.rb', line 13

def == other
  other.class == self.class && attributes == other.attributes
end