Class: Authorization::DevelopmentSupport::ChangeSupporter::ApproachChecker
- Inherits:
-
Object
- Object
- Authorization::DevelopmentSupport::ChangeSupporter::ApproachChecker
- Defined in:
- lib/declarative_authorization/development_support/change_supporter.rb
Instance Attribute Summary collapse
-
#failed_tests ⇒ Object
readonly
Returns the value of attribute failed_tests.
-
#users ⇒ Object
readonly
Returns the value of attribute users.
Instance Method Summary collapse
- #assert(ok) ⇒ Object
- #check(engine, users) ⇒ Object
-
#initialize(analyzer, tests) ⇒ ApproachChecker
constructor
A new instance of ApproachChecker.
- #permit?(*args) ⇒ Boolean
Constructor Details
#initialize(analyzer, tests) ⇒ ApproachChecker
Returns a new instance of ApproachChecker.
73 74 75 |
# File 'lib/declarative_authorization/development_support/change_supporter.rb', line 73 def initialize (analyzer, tests) @analyzer, @tests = analyzer, tests end |
Instance Attribute Details
#failed_tests ⇒ Object (readonly)
Returns the value of attribute failed_tests.
71 72 73 |
# File 'lib/declarative_authorization/development_support/change_supporter.rb', line 71 def failed_tests @failed_tests end |
#users ⇒ Object (readonly)
Returns the value of attribute users.
71 72 73 |
# File 'lib/declarative_authorization/development_support/change_supporter.rb', line 71 def users @users end |
Instance Method Details
#assert(ok) ⇒ Object
88 89 90 91 |
# File 'lib/declarative_authorization/development_support/change_supporter.rb', line 88 def assert (ok) @failed_tests << Test.new(*([!@current_permit_result] + @current_test_args)) unless ok @ok &&= ok end |
#check(engine, users) ⇒ Object
77 78 79 80 81 82 83 84 85 86 |
# File 'lib/declarative_authorization/development_support/change_supporter.rb', line 77 def check (engine, users) @current_engine = engine @failed_tests = [] @current_test_args = nil @current_permit_result = nil @users = users @ok = true instance_eval(&@tests) @ok end |
#permit?(*args) ⇒ Boolean
93 94 95 96 97 |
# File 'lib/declarative_authorization/development_support/change_supporter.rb', line 93 def permit? (*args) @current_test_args = args @current_permit_result = @current_engine.permit?( *(args[0...-1] + [args.last.merge(:skip_attribute_test => true)])) end |