Class: Triggerino::ActionList

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Enumerable, Observable
Defined in:
lib/triggerino/action_list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(observer, *actions) ⇒ ActionList

Returns a new instance of ActionList.



14
15
16
17
18
19
# File 'lib/triggerino/action_list.rb', line 14

def initialize observer, *actions
  @actions  = actions
  @selected = @actions.first
  add_observer observer
  notify_changed
end

Instance Attribute Details

#selectedObject

Returns the value of attribute selected.



12
13
14
# File 'lib/triggerino/action_list.rb', line 12

def selected
  @selected
end

Instance Method Details

#select_nextObject



21
22
23
24
# File 'lib/triggerino/action_list.rb', line 21

def select_next
  @selected = @actions[selected_index + 1] || @actions.first
  notify_changed
end