Class: CanTango::PermissionEngine::Compiler
- Inherits:
-
Object
- Object
- CanTango::PermissionEngine::Compiler
- Defined in:
- lib/cantango/permission_engine/compiler.rb
Instance Attribute Summary collapse
-
#categories ⇒ Object
readonly
Returns the value of attribute categories.
-
#permission ⇒ Object
readonly
Returns the value of attribute permission.
Instance Method Summary collapse
- #can_eval(&block) ⇒ Object
- #cannot_eval(&block) ⇒ Object
- #compile!(permission) ⇒ Object
- #eval_statements ⇒ Object
-
#initialize ⇒ Compiler
constructor
A new instance of Compiler.
- #to_hashie ⇒ Object
Constructor Details
#initialize ⇒ Compiler
Returns a new instance of Compiler.
6 7 |
# File 'lib/cantango/permission_engine/compiler.rb', line 6 def initialize end |
Instance Attribute Details
#categories ⇒ Object (readonly)
Returns the value of attribute categories.
4 5 6 |
# File 'lib/cantango/permission_engine/compiler.rb', line 4 def categories @categories end |
#permission ⇒ Object (readonly)
Returns the value of attribute permission.
4 5 6 |
# File 'lib/cantango/permission_engine/compiler.rb', line 4 def @permission end |
Instance Method Details
#can_eval(&block) ⇒ Object
22 23 24 |
# File 'lib/cantango/permission_engine/compiler.rb', line 22 def can_eval &block build_statements :can, &block end |
#cannot_eval(&block) ⇒ Object
26 27 28 |
# File 'lib/cantango/permission_engine/compiler.rb', line 26 def cannot_eval &block build_statements :cannot, &block end |
#compile!(permission) ⇒ Object
9 10 11 12 |
# File 'lib/cantango/permission_engine/compiler.rb', line 9 def compile! @permission = self end |
#eval_statements ⇒ Object
18 19 20 |
# File 'lib/cantango/permission_engine/compiler.rb', line 18 def eval_statements {:can => can_eval, :cannot => cannot_eval} end |
#to_hashie ⇒ Object
14 15 16 |
# File 'lib/cantango/permission_engine/compiler.rb', line 14 def to_hashie Hashie::Mash.new(eval_statements) end |