Class: OpenTox::Policy
- Inherits:
-
Object
- Object
- OpenTox::Policy
- Defined in:
- lib/policy.rb
Overview
single policy in a policies instance
Defined Under Namespace
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#rules ⇒ Object
Returns the value of attribute rules.
-
#subject_group ⇒ Object
Returns the value of attribute subject_group.
-
#subjects ⇒ Object
Returns the value of attribute subjects.
Instance Method Summary collapse
-
#initialize(name) ⇒ Policy
constructor
A new instance of Policy.
-
#new_rule(name, uri) ⇒ Object
create a new rule instance for the policy.
-
#new_subject(name, type, value) ⇒ Object
create a new subject instance for the policy.
-
#uris ⇒ Array
Set of uris affected by policy.
Constructor Details
#initialize(name) ⇒ Policy
Returns a new instance of Policy.
190 191 192 193 194 195 |
# File 'lib/policy.rb', line 190 def initialize(name) @name = name @rules = {} @subject_group = "" @subjects = {} end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
188 189 190 |
# File 'lib/policy.rb', line 188 def name @name end |
#rules ⇒ Object
Returns the value of attribute rules.
188 189 190 |
# File 'lib/policy.rb', line 188 def rules @rules end |
#subject_group ⇒ Object
Returns the value of attribute subject_group.
188 189 190 |
# File 'lib/policy.rb', line 188 def subject_group @subject_group end |
#subjects ⇒ Object
Returns the value of attribute subjects.
188 189 190 |
# File 'lib/policy.rb', line 188 def subjects @subjects end |
Instance Method Details
#new_rule(name, uri) ⇒ Object
create a new rule instance for the policy
198 199 200 |
# File 'lib/policy.rb', line 198 def new_rule(name, uri) @rules[name] = Rule.new(name, uri) end |
#new_subject(name, type, value) ⇒ Object
create a new subject instance for the policy
203 204 205 |
# File 'lib/policy.rb', line 203 def new_subject(name, type, value) @subjects[name] = Subject.new(name, type, value) end |
#uris ⇒ Array
Returns set of uris affected by policy.
208 209 210 |
# File 'lib/policy.rb', line 208 def uris @rules.collect{ |k,v| v.uri }.uniq end |