Class: Authorization::DevelopmentSupport::AnalyzerEngine::Rule

Inherits:
Object
  • Object
show all
Defined in:
lib/declarative_authorization/development_support/development_support.rb

Constant Summary collapse

@@rule_objects =
{}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rule, engine) ⇒ Rule

Returns a new instance of Rule.



148
149
150
151
# File 'lib/declarative_authorization/development_support/development_support.rb', line 148

def initialize (rule, engine)
  @rule = rule
  @engine = engine
end

Instance Attribute Details

#ruleObject (readonly)

Returns the value of attribute rule.



147
148
149
# File 'lib/declarative_authorization/development_support/development_support.rb', line 147

def rule
  @rule
end

Class Method Details

.for_rule(rule, engine) ⇒ Object



155
156
157
# File 'lib/declarative_authorization/development_support/development_support.rb', line 155

def self.for_rule (rule, engine)
  @@rule_objects[[rule, engine]] ||= new(rule, engine)
end

Instance Method Details

#privilegesObject



152
153
154
# File 'lib/declarative_authorization/development_support/development_support.rb', line 152

def privileges
  PrivilegesSet.new(self, @engine, @rule.privileges.collect {|privilege| Privilege.for_sym(privilege, @engine) })
end