Class: Croudia::Identity

Inherits:
Base
  • Object
show all
Defined in:
lib/croudia/identity.rb

Direct Known Subclasses

SecretMail, Status, User

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#[], attr_object_reader, attr_reader, #attrs, #inspect

Constructor Details

#initializeIdentity

Returns a new instance of Identity.

Raises:

  • (ArgumentError)


10
11
12
13
14
# File 'lib/croudia/identity.rb', line 10

def initialize(*)
  super
  raise ArgumentError, 'argument must have an "id" key' unless id
  @attrs['id_str'] ||= id.to_s
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/croudia/identity.rb', line 5

def id
  @id
end

#id_strObject (readonly)

Returns the value of attribute id_str.



5
6
7
# File 'lib/croudia/identity.rb', line 5

def id_str
  @id_str
end

Instance Method Details

#==(other) ⇒ Boolean

Parameters:

Returns:

  • (Boolean)


18
19
20
# File 'lib/croudia/identity.rb', line 18

def ==(other)
  super || self.class == other.class && id == other.id
end