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(stacks = nil) ⇒ StackCollection
constructor
A new instance of StackCollection.
Constructor Details
#initialize(stacks = nil) ⇒ StackCollection
Returns a new instance of StackCollection.
8 9 10 |
# File 'lib/murk/model/stack_collection.rb', line 8 def initialize(stacks = nil) @stacks = stacks || [] end |
Instance Method Details
#add(stack) ⇒ Object
12 13 14 |
# File 'lib/murk/model/stack_collection.rb', line 12 def add(stack) @stacks << stack end |
#each(&block) ⇒ Object
16 17 18 |
# File 'lib/murk/model/stack_collection.rb', line 16 def each(&block) @stacks.each(&block) end |
#find_by_name(name, env: nil) ⇒ Object
20 21 22 23 24 |
# File 'lib/murk/model/stack_collection.rb', line 20 def find_by_name(name, env: nil) find do |stack| stack.name == name && stack.env == env end end |