Class: PM::Operation
- Inherits:
-
PolicyElement
- Object
- PolicyElement
- PM::Operation
- Defined in:
- lib/policy_machine/policy_element.rb
Overview
An operation set in a policy machine.
Instance Attribute Summary
Attributes inherited from PolicyElement
#extra_attributes, #policy_machine_uuid, #stored_pe, #unique_identifier
Class Method Summary collapse
-
.all(pm_storage_adapter, options = {}) ⇒ Object
Return all policy elements of a particular type (e.g. all users).
- .create(unique_identifier, policy_machine_uuid, pm_storage_adapter, extra_attributes = {}) ⇒ Object
Instance Method Summary collapse
-
#associations ⇒ Object
Return all associations in which this Operation is included Associations are arrays of PM::Attributes.
Methods inherited from PolicyElement
#==, #assign_to, #connected?, convert_stored_pe_to_pe, #delete, #initialize, #inspect, #method_missing, #respond_to_missing?, #unassign, #update
Constructor Details
This class inherits a constructor from PM::PolicyElement
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class PM::PolicyElement
Class Method Details
.all(pm_storage_adapter, options = {}) ⇒ Object
Return all policy elements of a particular type (e.g. all users)
238 239 240 241 242 |
# File 'lib/policy_machine/policy_element.rb', line 238 def self.all(pm_storage_adapter, = {}) pm_storage_adapter.find_all_of_type_operation().map do |stored_pe| convert_stored_pe_to_pe(stored_pe, pm_storage_adapter, PM::Operation) end end |
.create(unique_identifier, policy_machine_uuid, pm_storage_adapter, extra_attributes = {}) ⇒ Object
231 232 233 234 235 |
# File 'lib/policy_machine/policy_element.rb', line 231 def self.create(unique_identifier, policy_machine_uuid, pm_storage_adapter, extra_attributes = {}) new_pe = new(unique_identifier, policy_machine_uuid, pm_storage_adapter, nil, extra_attributes) new_pe.stored_pe = pm_storage_adapter.add_operation(unique_identifier, policy_machine_uuid, extra_attributes) new_pe end |
Instance Method Details
#associations ⇒ Object
Return all associations in which this Operation is included Associations are arrays of PM::Attributes.
247 248 249 250 251 |
# File 'lib/policy_machine/policy_element.rb', line 247 def associations @pm_storage_adapter.associations_with(self.stored_pe).map do |assoc| PM::Association.new(assoc[0], assoc[1], assoc[2], @pm_storage_adapter) end end |