Class: InputScanner
- Inherits:
-
ServiceBase
- Object
- ServiceBase
- InputScanner
- Defined in:
- lib/rosetta/services/input_scanner.rb
Overview
Scans and tokenises source text.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(input) ⇒ InputScanner
constructor
A new instance of InputScanner.
Methods inherited from ServiceBase
Constructor Details
#initialize(input) ⇒ InputScanner
Returns a new instance of InputScanner.
8 9 10 |
# File 'lib/rosetta/services/input_scanner.rb', line 8 def initialize(input) @input = input end |
Instance Method Details
#call ⇒ Object
12 13 14 |
# File 'lib/rosetta/services/input_scanner.rb', line 12 def call @input.split("\n").map { |line| TokenResolver.call(line) }.flatten end |