Class: Rucc::Kind

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/rucc/kind.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, name) ⇒ Kind

Returns a new instance of Kind.



11
12
13
14
# File 'lib/rucc/kind.rb', line 11

def initialize(id, name)
  @id  = id  # Used only for <=>
  @name = name
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



15
16
17
# File 'lib/rucc/kind.rb', line 15

def id
  @id
end

Class Method Details

.def_kind(name, id) ⇒ Object



6
7
8
# File 'lib/rucc/kind.rb', line 6

def def_kind(name, id)
  const_set(name, self.new(id, name))
end

Instance Method Details

#<=>(other) ⇒ Object



17
18
19
# File 'lib/rucc/kind.rb', line 17

def <=>(other)
  @id <=> other.id
end

#to_sObject



21
22
23
# File 'lib/rucc/kind.rb', line 21

def to_s
  @name.to_s
end