Class: RapidTransit::ActionList
- Inherits:
-
Object
- Object
- RapidTransit::ActionList
- Includes:
- Enumerable
- Defined in:
- lib/rapid_transit/action_list.rb
Instance Attribute Summary collapse
-
#actions ⇒ Object
Returns the value of attribute actions.
-
#columns ⇒ Object
Returns the value of attribute columns.
Instance Method Summary collapse
- #add(action) ⇒ Object
- #each ⇒ Object
-
#initialize(columns = []) ⇒ ActionList
constructor
A new instance of ActionList.
- #keys ⇒ Object
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
#actions ⇒ Object
Returns the value of attribute actions.
4 5 6 |
# File 'lib/rapid_transit/action_list.rb', line 4 def actions @actions end |
#columns ⇒ Object
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 |
#each ⇒ Object
15 16 17 |
# File 'lib/rapid_transit/action_list.rb', line 15 def each @actions.each { |a| yield a } end |
#keys ⇒ Object
19 20 21 |
# File 'lib/rapid_transit/action_list.rb', line 19 def keys columns + @actions.map { |a| a.key } end |