Class: Egree::ReferenceId

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/egree/reference_id.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id) ⇒ ReferenceId

Returns a new instance of ReferenceId.



13
14
15
# File 'lib/egree/reference_id.rb', line 13

def initialize id
  @id = id
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



11
12
13
# File 'lib/egree/reference_id.rb', line 11

def id
  @id
end

Class Method Details

.generateObject



7
8
9
# File 'lib/egree/reference_id.rb', line 7

def self.generate
  new SecureRandom.uuid
end

Instance Method Details

#<=>(other) ⇒ Object



21
22
23
# File 'lib/egree/reference_id.rb', line 21

def <=> other
  other.is_a?(self.class) && self.id <=> other.id
end

#to_sObject



17
18
19
# File 'lib/egree/reference_id.rb', line 17

def to_s
  id.to_s
end