Class: Action

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

Overview

Defines a base action.

Direct Known Subclasses

MonkeyAction

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, weight) ⇒ Action

Returns a new instance of Action.



8
9
10
11
12
13
14
15
# File 'lib/Action/action.rb', line 8

def initialize(value, weight)
  @value = value
  @weight = weight
  @action_time = Time.now
  @action_completed = false

  self
end

Instance Attribute Details

#action_timeObject

Returns the value of attribute action_time.



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

def action_time
  @action_time
end

#valueObject (readonly)

Returns the value of attribute value.



5
6
7
# File 'lib/Action/action.rb', line 5

def value
  @value
end

#weightObject (readonly)

Returns the value of attribute weight.



5
6
7
# File 'lib/Action/action.rb', line 5

def weight
  @weight
end

Instance Method Details

#action_completed=(value) ⇒ Object



21
22
23
# File 'lib/Action/action.rb', line 21

def action_completed=(value)
  @action_completed = value
end

#action_completed?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/Action/action.rb', line 17

def action_completed?
  @action_completed
end