Class: Murk::Model::StackCollection

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/murk/model/stack_collection.rb

Instance Method Summary collapse

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