Class: Strategize::Configuration
- Inherits:
-
Object
- Object
- Strategize::Configuration
- Defined in:
- lib/strategize/configuration.rb
Instance Attribute Summary collapse
-
#policy_evaluator ⇒ Object
Returns the value of attribute policy_evaluator.
-
#rule_evaluator ⇒ Object
Returns the value of attribute rule_evaluator.
Instance Method Summary collapse
-
#add_policy_group(name) {|policy_group| ... } ⇒ Object
Add a policy group to the policy_groups hash.
-
#initialize ⇒ Configuration
constructor
Create a new instance of [Configuration] class.
-
#policy_group(name) ⇒ PolicyGroup
Get a specific [PolicyGroup] that has been defined in [Configuration].
-
#policy_groups ⇒ Hash
Get a hash of all the policies groups that have been defined.
Constructor Details
#initialize ⇒ Configuration
Create a new instance of [Configuration] class.
6 7 8 9 |
# File 'lib/strategize/configuration.rb', line 6 def initialize @rule_evaluator = Strategize::RuleEvaluator @policy_evaluator = Strategize::PolicyEvaluator end |
Instance Attribute Details
#policy_evaluator ⇒ Object
Returns the value of attribute policy_evaluator.
3 4 5 |
# File 'lib/strategize/configuration.rb', line 3 def policy_evaluator @policy_evaluator end |
#rule_evaluator ⇒ Object
Returns the value of attribute rule_evaluator.
3 4 5 |
# File 'lib/strategize/configuration.rb', line 3 def rule_evaluator @rule_evaluator end |
Instance Method Details
#add_policy_group(name) {|policy_group| ... } ⇒ Object
Add a policy group to the policy_groups hash
48 49 50 51 52 |
# File 'lib/strategize/configuration.rb', line 48 def add_policy_group(name) policy_groups[name] = PolicyGroup.new unless policy_groups.key?(name) policy_group = policy_groups[name] yield(policy_group) end |
#policy_group(name) ⇒ PolicyGroup
Get a specific [PolicyGroup] that has been defined in [Configuration]
58 59 60 |
# File 'lib/strategize/configuration.rb', line 58 def policy_group(name) policy_groups[name] end |
#policy_groups ⇒ Hash
Get a hash of all the policies groups that have been defined
40 41 42 |
# File 'lib/strategize/configuration.rb', line 40 def policy_groups @policy_groups ||= {} end |