Class: Feedx::Format::Parquet::Decoder
- Inherits:
-
Abstract::Decoder
- Object
- Abstract::Wrapper
- Abstract::Decoder
- Feedx::Format::Parquet::Decoder
- Defined in:
- lib/feedx/format/parquet.rb
Instance Method Summary collapse
- #decode(target) ⇒ Object
- #eof? ⇒ Boolean
-
#initialize(io) ⇒ Decoder
constructor
A new instance of Decoder.
Methods inherited from Abstract::Decoder
Methods inherited from Abstract::Wrapper
Constructor Details
#initialize(io) ⇒ Decoder
Returns a new instance of Decoder.
14 15 16 17 18 19 |
# File 'lib/feedx/format/parquet.rb', line 14 def initialize(io, **) super(io) @table = read_table @cursor = 0 end |
Instance Method Details
#decode(target) ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/feedx/format/parquet.rb', line 25 def decode(target, **) return if eof? rec = Record.new(@table, @cursor) @cursor += 1 target = target.allocate if target.is_a?(Class) target.from_parquet(rec) target end |
#eof? ⇒ Boolean
21 22 23 |
# File 'lib/feedx/format/parquet.rb', line 21 def eof? @cursor >= @table.n_rows end |