Class: Jerakia::Launcher
- Inherits:
-
Object
- Object
- Jerakia::Launcher
- Defined in:
- lib/jerakia/launcher.rb
Overview
Here we take a request object and read in the policy file which is evalulated in this instance
Direct Known Subclasses
Instance Attribute Summary collapse
-
#answer ⇒ Object
readonly
Returns the value of attribute answer.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Instance Method Summary collapse
-
#initialize(req) ⇒ Launcher
constructor
A new instance of Launcher.
- #invoke ⇒ Object
- #policy(name, opts = {}, &block) ⇒ Object
Constructor Details
#initialize(req) ⇒ Launcher
Returns a new instance of Launcher.
8 9 10 11 |
# File 'lib/jerakia/launcher.rb', line 8 def initialize(req) @@request = req invoke end |
Instance Attribute Details
#answer ⇒ Object (readonly)
Returns the value of attribute answer.
7 8 9 |
# File 'lib/jerakia/launcher.rb', line 7 def answer @answer end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
6 7 8 |
# File 'lib/jerakia/launcher.rb', line 6 def request @request end |
Instance Method Details
#invoke ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/jerakia/launcher.rb', line 13 def invoke policy_name=request.policy.to_s Jerakia.log.debug "Invoked lookup for #{@@request.key} using policy #{policy_name}" filename=File.join(Jerakia.config.policydir, "#{policy_name}.rb") begin policydata=Jerakia.filecache(filename) rescue Exception => e Jerakia.crit("Problem loading policy from #{filename}") end instance_eval policydata end |