Class: Crapshoot::Scanner
- Inherits:
-
Object
- Object
- Crapshoot::Scanner
- Defined in:
- lib/crapshoot/scanner.rb
Overview
Turns a string into an array of tokens.
Instance Method Summary collapse
-
#initialize ⇒ Scanner
constructor
A new instance of Scanner.
- #inspect_errors ⇒ Object
- #parse(line) ⇒ Object
- #successful? ⇒ Boolean
Constructor Details
Instance Method Details
#inspect_errors ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/crapshoot/scanner.rb', line 28 def inspect_errors return 'No error' if successful? backtrace = @exception.backtrace filtered_backtrace = [] backtrace.each do |i| break if i.include? __FILE__ filtered_backtrace << i end return "#{ @exception. } at #{ filtered_backtrace.join("\n")}" end |
#parse(line) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/crapshoot/scanner.rb', line 13 def parse(line) @line = line begin @result = @parser.parse @line return @result rescue => e @exception = e return nil end end |
#successful? ⇒ Boolean
24 25 26 |
# File 'lib/crapshoot/scanner.rb', line 24 def successful? @result end |