Method: ItamaeMitsurin::Resource::Base#initialize

Defined in:
lib/itamae-mitsurin/resource/base.rb

#initialize(recipe, resource_name, &block) ⇒ Base

Returns a new instance of Base.



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/itamae-mitsurin/resource/base.rb', line 104

def initialize(recipe, resource_name, &block)
  clear_current_attributes
  @recipe = recipe
  @resource_name = resource_name
  @updated = false

  EvalContext.new(self).tap do |context|
    context.instance_eval(&block) if block
    @attributes = context.attributes
    @notifications = context.notifications
    @subscriptions = context.subscriptions
    @only_if_command = context.only_if_command
    @not_if_command = context.not_if_command
    @verify_commands = context.verify_commands
  end

  process_attributes
end