Class: RapidTransit::ActionList

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/rapid_transit/action_list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(columns = []) ⇒ ActionList

Returns a new instance of ActionList.



6
7
8
9
# File 'lib/rapid_transit/action_list.rb', line 6

def initialize(columns = [])
  @actions = []
  @columns = columns
end

Instance Attribute Details

#actionsObject

Returns the value of attribute actions.



4
5
6
# File 'lib/rapid_transit/action_list.rb', line 4

def actions
  @actions
end

#columnsObject

Returns the value of attribute columns.



4
5
6
# File 'lib/rapid_transit/action_list.rb', line 4

def columns
  @columns
end

Instance Method Details

#add(action) ⇒ Object



11
12
13
# File 'lib/rapid_transit/action_list.rb', line 11

def add(action)
  @actions << action if action.valid?(self)
end

#eachObject



15
16
17
# File 'lib/rapid_transit/action_list.rb', line 15

def each
  @actions.each { |a| yield a }
end

#keysObject



19
20
21
# File 'lib/rapid_transit/action_list.rb', line 19

def keys
  columns + @actions.map { |a| a.key }
end