Class: Croudia::Identity
Direct Known Subclasses
Instance Method Summary collapse
- #==(other) ⇒ Boolean
- #id ⇒ Integer
-
#initialize ⇒ Identity
constructor
A new instance of Identity.
Methods inherited from Base
Constructor Details
#initialize ⇒ Identity
Returns a new instance of Identity.
5 6 7 8 9 |
# File 'lib/croudia/identity.rb', line 5 def initialize(*) super raise ArgumentError, 'argument must have an "id" key' unless id @attrs['id_str'] ||= id.to_s end |
Instance Method Details
#==(other) ⇒ Boolean
13 14 15 |
# File 'lib/croudia/identity.rb', line 13 def ==(other) super || self.class == other.class && id == other.id end |
#id ⇒ Integer
18 19 20 |
# File 'lib/croudia/identity.rb', line 18 def id @attrs['id'] || @attrs[:id] end |