Class: Campa::Reader
- Inherits:
-
Object
- Object
- Campa::Reader
- Defined in:
- lib/campa/reader.rb
Overview
rubocop: disable Metrics/ClassLength
Instance Method Summary collapse
-
#initialize(input) ⇒ Reader
constructor
rubocop: enable Metrics/ClassLength.
- #next ⇒ Object
Constructor Details
#initialize(input) ⇒ Reader
rubocop: enable Metrics/ClassLength
7 8 9 10 |
# File 'lib/campa/reader.rb', line 7 def initialize(input) @input = to_io_like(input) next_char end |
Instance Method Details
#next ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/campa/reader.rb', line 12 def next eat_separators return read if !@input.eof? return if @current_char.nil? # Exhaust the reader if @input.eof? and !@current_char.nil? read.tap { @current_char = nil } end |