Class: HAL9000::Action

Inherits:
Object
  • Object
show all
Defined in:
lib/hal9000/action.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(thought, action) ⇒ Action

Returns a new instance of Action.



10
11
12
13
# File 'lib/hal9000/action.rb', line 10

def initialize(thought, action)
  @thought = thought
  @action = action
end

Instance Attribute Details

#actionObject

Returns the value of attribute action.



8
9
10
# File 'lib/hal9000/action.rb', line 8

def action
  @action
end

#thoughtObject

Returns the value of attribute thought.



6
7
8
# File 'lib/hal9000/action.rb', line 6

def thought
  @thought
end

Instance Method Details

#<=>(other) ⇒ Object



15
16
17
# File 'lib/hal9000/action.rb', line 15

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

#to_sObject



19
20
21
# File 'lib/hal9000/action.rb', line 19

def to_s
  "#{thought} => #{action}"
end