Class: Authorization::DevelopmentSupport::ChangeAnalyzer::ApproachChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/declarative_authorization/development_support/change_analyzer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_countObject (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

#usersObject (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

Returns:

  • (Boolean)


90
91
92
# File 'lib/declarative_authorization/development_support/change_analyzer.rb', line 90

def permit? (*args)
  @current_engine.permit?(*args)
end