Class: Monoz::ActionCollection
- Inherits:
-
Object
- Object
- Monoz::ActionCollection
- Includes:
- Enumerable
- Defined in:
- lib/monoz/action_collection.rb
Instance Method Summary collapse
- #all ⇒ Object
- #exist?(name) ⇒ Boolean
- #find(name) ⇒ Object
-
#initialize ⇒ ActionCollection
constructor
A new instance of ActionCollection.
Constructor Details
#initialize ⇒ ActionCollection
Returns a new instance of ActionCollection.
10 11 12 13 |
# File 'lib/monoz/action_collection.rb', line 10 def initialize @items = [] populate_items end |
Instance Method Details
#all ⇒ Object
23 24 25 |
# File 'lib/monoz/action_collection.rb', line 23 def all @items end |
#exist?(name) ⇒ Boolean
15 16 17 |
# File 'lib/monoz/action_collection.rb', line 15 def exist?(name) !!find(name) end |
#find(name) ⇒ Object
19 20 21 |
# File 'lib/monoz/action_collection.rb', line 19 def find(name) @items.select { |i| i.name == name.to_s }&.first end |