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.
96 97 98 |
# File 'lib/declarative_authorization/development_support/change_supporter.rb', line 96 def initialize (analyzer, tests) @analyzer, @tests = analyzer, tests end |
Instance Attribute Details
#failed_tests ⇒ Object (readonly)
Returns the value of attribute failed_tests.
94 95 96 |
# File 'lib/declarative_authorization/development_support/change_supporter.rb', line 94 def failed_tests @failed_tests end |
#users ⇒ Object (readonly)
Returns the value of attribute users.
94 95 96 |
# File 'lib/declarative_authorization/development_support/change_supporter.rb', line 94 def users @users end |
Instance Method Details
#assert(ok) ⇒ Object
111 112 113 114 |
# File 'lib/declarative_authorization/development_support/change_supporter.rb', line 111 def assert (ok) @failed_tests << Test.new(*([!@current_permit_result] + @current_test_args)) unless ok @ok &&= ok end |
#check(engine, users) ⇒ Object
100 101 102 103 104 105 106 107 108 109 |
# File 'lib/declarative_authorization/development_support/change_supporter.rb', line 100 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
116 117 118 119 120 |
# File 'lib/declarative_authorization/development_support/change_supporter.rb', line 116 def permit? (*args) @current_test_args = args @current_permit_result = @current_engine.permit?( *(args[0...-1] + [args.last.merge(:skip_attribute_test => true)])) end |