Class: Acl9::Dsl::Generators::FilterLambda
- Inherits:
-
BaseGenerator
- Object
- Base
- BaseGenerator
- Acl9::Dsl::Generators::FilterLambda
- Defined in:
- lib/acl9/controller_extensions/generators.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(subject_method) ⇒ FilterLambda
constructor
A new instance of FilterLambda.
- #install_on(controller_class, options) ⇒ Object
- #to_proc ⇒ Object
Methods inherited from Base
#acl_block!, #allowance_expression, #default_action
Constructor Details
#initialize(subject_method) ⇒ FilterLambda
Returns a new instance of FilterLambda.
87 88 89 90 91 |
# File 'lib/acl9/controller_extensions/generators.rb', line 87 def initialize(subject_method) super @controller = 'controller' end |
Instance Method Details
#install_on(controller_class, options) ⇒ Object
93 94 95 96 97 |
# File 'lib/acl9/controller_extensions/generators.rb', line 93 def install_on(controller_class, ) super controller_class.send(:before_filter, , &self.to_proc) end |
#to_proc ⇒ Object
99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/acl9/controller_extensions/generators.rb', line 99 def to_proc code = <<-RUBY lambda do |controller| unless #{allowance_expression} #{_access_denied} end end RUBY self.instance_eval(code, __FILE__, __LINE__) rescue SyntaxError raise FilterSyntaxError, code end |