Class: Jerakia::Dsl::Policy
- Inherits:
-
Object
- Object
- Jerakia::Dsl::Policy
- Defined in:
- lib/jerakia/dsl/policy.rb
Instance Attribute Summary collapse
-
#instance ⇒ Object
readonly
Returns the value of attribute instance.
-
#request ⇒ Object
Returns the value of attribute request.
Class Method Summary collapse
Instance Method Summary collapse
- #evaluate_file(filename) ⇒ Object
-
#initialize ⇒ Policy
constructor
A new instance of Policy.
- #policy(name, opts = {}, &block) ⇒ Object
Constructor Details
#initialize ⇒ Policy
Returns a new instance of Policy.
21 22 |
# File 'lib/jerakia/dsl/policy.rb', line 21 def initialize() end |
Instance Attribute Details
#instance ⇒ Object (readonly)
Returns the value of attribute instance.
19 20 21 |
# File 'lib/jerakia/dsl/policy.rb', line 19 def instance @instance end |
#request ⇒ Object
Returns the value of attribute request.
18 19 20 |
# File 'lib/jerakia/dsl/policy.rb', line 18 def request @request end |
Class Method Details
.evaluate(&block) ⇒ Object
12 13 14 15 16 |
# File 'lib/jerakia/dsl/policy.rb', line 12 def self.evaluate(&block) policy = new policy.instance_eval &block policy.instance end |
.evaluate_file(filename) ⇒ Object
6 7 8 9 10 |
# File 'lib/jerakia/dsl/policy.rb', line 6 def self.evaluate_file(filename) policy = new policy.evaluate_file(filename) policy.instance end |
Instance Method Details
#evaluate_file(filename) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/jerakia/dsl/policy.rb', line 24 def evaluate_file(filename) policydata = Jerakia::Cache::File.retrieve(filename) unless policydata raise Jerakia::PolicyError, "Could not load policy file, #{filename}" end instance_eval policydata end |