Class: Jerakia::Dsl::Policyblock

Inherits:
Object
  • Object
show all
Defined in:
lib/jerakia/dsl/policy.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(policy) ⇒ Policyblock

Returns a new instance of Policyblock


43
44
45
# File 'lib/jerakia/dsl/policy.rb', line 43

def initialize(policy)
  @policy = policy
end

Instance Attribute Details

#policyObject

Returns the value of attribute policy


41
42
43
# File 'lib/jerakia/dsl/policy.rb', line 41

def policy
  @policy
end

Class Method Details

.evaluate(policy, &block) ⇒ Object


47
48
49
50
# File 'lib/jerakia/dsl/policy.rb', line 47

def self.evaluate(policy, &block)
  policyblock = new(policy)
  policyblock.instance_eval &block
end

Instance Method Details

#lookup(name, opts = {}, &block) ⇒ Object


52
53
54
55
56
57
58
# File 'lib/jerakia/dsl/policy.rb', line 52

def lookup(name, opts = {}, &block)
  Jerakia.log.debug("Adding lookup #{name} for policy #{policy}")
  policy.lookups << Proc.new do |request, scope| 
    Jerakia.log.debug("Invoking lookup #{name}")
    Jerakia::Dsl::Lookup.evaluate(name, request, scope, opts, &block)
  end
end