Class: Lingo::AgendaItem

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/lingo/agenda_item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cmd, param = nil) ⇒ AgendaItem



35
36
37
# File 'lib/lingo/agenda_item.rb', line 35

def initialize(cmd, param = nil)
  @cmd, @param = cmd || '', param || ''
end

Instance Attribute Details

#cmdObject (readonly)

Returns the value of attribute cmd



33
34
35
# File 'lib/lingo/agenda_item.rb', line 33

def cmd
  @cmd
end

#paramObject (readonly)

Returns the value of attribute param



33
34
35
# File 'lib/lingo/agenda_item.rb', line 33

def param
  @param
end

Instance Method Details

#<=>(other) ⇒ Object



39
40
41
# File 'lib/lingo/agenda_item.rb', line 39

def <=>(other)
  other.is_a?(self.class) ? to_a <=> other.to_a : 1
end

#inspectObject



47
48
49
# File 'lib/lingo/agenda_item.rb', line 47

def inspect
  "*#{cmd.upcase}('#{param}')"
end

#to_aObject



43
44
45
# File 'lib/lingo/agenda_item.rb', line 43

def to_a
  [cmd, param]
end