Class: Chef::Sugar::Filters::CompileTime

Inherits:
Object
  • Object
show all
Defined in:
lib/chef/sugar/filters.rb

Overview

Evaluate resources at compile time instead of converge time.

Instance Method Summary collapse

Constructor Details

#initialize(recipe) ⇒ CompileTime

Returns a new instance of CompileTime.



8
9
10
# File 'lib/chef/sugar/filters.rb', line 8

def initialize(recipe)
  @recipe = recipe
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &block) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/chef/sugar/filters.rb', line 16

def method_missing(m, *args, &block)
  resource = @recipe.send(m, *args, &block)
  actions  = Array(resource.action)
  resource.action(:nothing)
  actions.each do |action|
    resource.run_action(action)
  end
end

Instance Method Details

#evaluate(&block) ⇒ Object



12
13
14
# File 'lib/chef/sugar/filters.rb', line 12

def evaluate(&block)
  instance_eval(&block)
end