Class: Itamae::Handler::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/itamae/handler/base.rb

Direct Known Subclasses

Debug, Fluentd, Json

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Base

Returns a new instance of Base.



8
9
10
11
12
13
14
# File 'lib/itamae/handler/base.rb', line 8

def initialize(options)
  @options = options

  @recipes = []
  @resources = []
  @actions = []
end

Instance Attribute Details

#actionsObject (readonly)

Returns the value of attribute actions.



6
7
8
# File 'lib/itamae/handler/base.rb', line 6

def actions
  @actions
end

#recipesObject (readonly)

Returns the value of attribute recipes.



6
7
8
# File 'lib/itamae/handler/base.rb', line 6

def recipes
  @recipes
end

#resourcesObject (readonly)

Returns the value of attribute resources.



6
7
8
# File 'lib/itamae/handler/base.rb', line 6

def resources
  @resources
end

Instance Method Details

#event(type, payload = {}) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/itamae/handler/base.rb', line 16

def event(type, payload = {})
  case type
  when :recipe_started
    @recipes << payload
  when :recipe_completed, :recipe_failed
    @recipes.pop
  when :resource_started
    @resources << payload
  when :resource_completed, :resource_failed
    @resources.pop
  when :action_started
    @actions << payload
  when :action_completed, :action_failed
    @actions.pop
  end
end