class PolicyMachineStorageAdapter::InMemory::PersistedPolicyElement

Class to represent policy elements

Attributes

extra_attributes[R]
pe_type[R]
persisted[RW]
policy_machine_uuid[R]
unique_identifier[R]

Public Class Methods

new(unique_identifier, policy_machine_uuid, pe_type, extra_attributes) click to toggle source

Ensure that attr keys are strings

# File lib/policy_machine_storage_adapters/in_memory.rb, line 246
def initialize(unique_identifier, policy_machine_uuid, pe_type, extra_attributes)
  @unique_identifier = unique_identifier
  @policy_machine_uuid = policy_machine_uuid
  @pe_type = pe_type
  @persisted = false
  @extra_attributes = extra_attributes
  extra_attributes.each do |key, value|
    define_singleton_method key, lambda {@extra_attributes[key]}
  end
end

Public Instance Methods

==(other) click to toggle source
# File lib/policy_machine_storage_adapters/in_memory.rb, line 257
def ==(other)
  return false unless other.is_a?(PersistedPolicyElement)
  self.unique_identifier == other.unique_identifier &&
    self.policy_machine_uuid == other.policy_machine_uuid &&
    self.pe_type == other.pe_type
end