Class: Authorization::DevelopmentSupport::ChangeAnalyzer::ApproachChecker
- Inherits:
-
Object
- Object
- Authorization::DevelopmentSupport::ChangeAnalyzer::ApproachChecker
- Defined in:
- lib/declarative_authorization/development_support/change_analyzer.rb
Instance Attribute Summary collapse
-
#failed_test_count ⇒ Object
readonly
Returns the value of attribute failed_test_count.
-
#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.
72 73 74 |
# File 'lib/declarative_authorization/development_support/change_analyzer.rb', line 72 def initialize (analyzer, tests) @analyzer, @tests = analyzer, tests end |
Instance Attribute Details
#failed_test_count ⇒ Object (readonly)
Returns the value of attribute failed_test_count.
70 71 72 |
# File 'lib/declarative_authorization/development_support/change_analyzer.rb', line 70 def failed_test_count @failed_test_count end |
#users ⇒ Object (readonly)
Returns the value of attribute users.
70 71 72 |
# File 'lib/declarative_authorization/development_support/change_analyzer.rb', line 70 def users @users end |
Instance Method Details
#assert(ok) ⇒ Object
85 86 87 88 |
# File 'lib/declarative_authorization/development_support/change_analyzer.rb', line 85 def assert (ok) @failed_test_count += 1 unless ok @ok &&= ok end |
#check(engine, users) ⇒ Object
76 77 78 79 80 81 82 83 |
# File 'lib/declarative_authorization/development_support/change_analyzer.rb', line 76 def check (engine, users) @current_engine = engine @failed_test_count = 0 @users = users @ok = true instance_eval(&@tests) @ok end |
#permit?(*args) ⇒ Boolean
90 91 92 |
# File 'lib/declarative_authorization/development_support/change_analyzer.rb', line 90 def permit? (*args) @current_engine.permit?(*args) end |