Class: PrismChecker::Checker
- Inherits:
-
Object
- Object
- PrismChecker::Checker
- Defined in:
- lib/prism_checker/checker.rb
Instance Attribute Summary collapse
-
#item ⇒ Object
readonly
Returns the value of attribute item.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
- #check(item, expectation) ⇒ Object
-
#initialize ⇒ Checker
constructor
A new instance of Checker.
- #report ⇒ Object
Constructor Details
#initialize ⇒ Checker
12 13 14 15 16 17 |
# File 'lib/prism_checker/checker.rb', line 12 def initialize @item = nil @expectation = nil @root = nil @result = nil end |
Instance Attribute Details
#item ⇒ Object (readonly)
Returns the value of attribute item.
10 11 12 |
# File 'lib/prism_checker/checker.rb', line 10 def item @item end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
10 11 12 |
# File 'lib/prism_checker/checker.rb', line 10 def result @result end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
10 11 12 |
# File 'lib/prism_checker/checker.rb', line 10 def root @root end |
Instance Method Details
#check(item, expectation) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/prism_checker/checker.rb', line 19 def check(item, expectation) prepare(item, expectation) # rubocop:disable Style/SymbolProc # rubocop is wrong walk_through do |node| node.check end # rubocop:enable Style/SymbolProc @result = true rescue Node::CheckFail @result = false rescue StandardError => e raise e.class, "#{report}\n#{e.}" end |
#report ⇒ Object
36 37 38 |
# File 'lib/prism_checker/checker.rb', line 36 def report ReportBuilder.new(@root).build end |