Class: Murk::Model::StackCollection
- Inherits:
-
Object
- Object
- Murk::Model::StackCollection
- Includes:
- Enumerable
- Defined in:
- lib/murk/model/stack_collection.rb
Instance Method Summary collapse
- #add(stack) ⇒ Object
- #each(&block) ⇒ Object
- #find_by_name(name, env: nil) ⇒ Object
-
#initialize ⇒ StackCollection
constructor
A new instance of StackCollection.
- #stack(name) ⇒ Object
Constructor Details
#initialize ⇒ StackCollection
Returns a new instance of StackCollection.
8 9 10 |
# File 'lib/murk/model/stack_collection.rb', line 8 def initialize @stacks = [] end |
Instance Method Details
#add(stack) ⇒ Object
12 13 14 15 |
# File 'lib/murk/model/stack_collection.rb', line 12 def add(stack) @stacks << stack stack.collection = self end |
#each(&block) ⇒ Object
17 18 19 |
# File 'lib/murk/model/stack_collection.rb', line 17 def each(&block) @stacks.each(&block) end |
#find_by_name(name, env: nil) ⇒ Object
21 22 23 24 25 |
# File 'lib/murk/model/stack_collection.rb', line 21 def find_by_name(name, env: nil) find do |stack| stack.name == name && stack.env == env end end |
#stack(name) ⇒ Object
27 28 29 |
# File 'lib/murk/model/stack_collection.rb', line 27 def stack(name) @stacks.find { |stack| stack.name == name.to_s } end |