Class: Lox::Scanner
- Inherits:
-
Object
- Object
- Lox::Scanner
- Defined in:
- lib/lox/scanner.rb
Instance Attribute Summary collapse
-
#input ⇒ Object
readonly
Returns the value of attribute input.
Instance Method Summary collapse
- #each_char ⇒ Object
-
#initialize(input) ⇒ Scanner
constructor
A new instance of Scanner.
Constructor Details
#initialize(input) ⇒ Scanner
Returns a new instance of Scanner.
7 8 9 |
# File 'lib/lox/scanner.rb', line 7 def initialize(input) @input = input end |
Instance Attribute Details
#input ⇒ Object (readonly)
Returns the value of attribute input.
5 6 7 |
# File 'lib/lox/scanner.rb', line 5 def input @input end |
Instance Method Details
#each_char ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/lox/scanner.rb', line 11 def each_char return enum_for(:each_char) unless block_given? input.each_line do |line| line.each_char do |character| yield(character) end end end |