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.



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

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

Instance Attribute Details

#action_completed=(value) ⇒ Object (writeonly)

Sets the attribute action_completed

Parameters:

  • value

    the value to set the attribute action_completed to.



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

def action_completed=(value)
  @action_completed = value
end

#action_timeObject

Returns the value of attribute action_time.



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

def action_time
  @action_time
end

#valueObject (readonly)

Returns the value of attribute value.



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

def value
  @value
end

#weightObject (readonly)

Returns the value of attribute weight.



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

def weight
  @weight
end

Instance Method Details

#action_completed?Boolean

Returns:

  • (Boolean)


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

def action_completed?
  @action_completed
end