Class: Economic::Entity::Handle
- Inherits:
-
Object
- Object
- Economic::Entity::Handle
- Defined in:
- lib/economic/entity.rb
Instance Attribute Summary (collapse)
-
- (Object) id
Returns the value of attribute id.
-
- (Object) number
Returns the value of attribute number.
Instance Method Summary (collapse)
- - (Object) ==(other)
- - (Object) [](key)
-
- (Handle) initialize(hash)
constructor
A new instance of Handle.
- - (Object) to_hash
Constructor Details
- (Handle) initialize(hash)
A new instance of Handle
6 7 8 9 |
# File 'lib/economic/entity.rb', line 6 def initialize(hash) @id = hash[:id] @number = hash[:number] end |
Instance Attribute Details
- (Object) id
Returns the value of attribute id
4 5 6 |
# File 'lib/economic/entity.rb', line 4 def id @id end |
- (Object) number
Returns the value of attribute number
4 5 6 |
# File 'lib/economic/entity.rb', line 4 def number @number end |
Instance Method Details
- (Object) ==(other)
22 23 24 25 26 |
# File 'lib/economic/entity.rb', line 22 def ==(other) return false if other.nil? return false unless other.respond_to?(:id) && other.respond_to?(:number) self.id == other.id && self.number == other.number end |
- (Object) [](key)
18 19 20 |
# File 'lib/economic/entity.rb', line 18 def [](key) {:id => @id, :number => @number}[key] end |
- (Object) to_hash
11 12 13 14 15 16 |
# File 'lib/economic/entity.rb', line 11 def to_hash hash = {} hash['Id'] = id unless id.blank? hash['Number'] = number unless number.blank? hash end |