Class: CsvReader::Builder
- Inherits:
-
Object
- Object
- CsvReader::Builder
- Defined in:
- lib/csvreader/builder.rb
Instance Method Summary collapse
-
#config ⇒ Object
(auto-)forward to wrapped parser note/fix: not all parser use/have config e.g.
- #foreach(path, **kwargs, &block) ⇒ Object
- #header(path, **kwargs) ⇒ Object
-
#initialize(parser) ⇒ Builder
constructor
A new instance of Builder.
- #open(path, mode = nil, **kwargs, &block) ⇒ Object
- #parse(str_or_readable, **kwargs, &block) ⇒ Object
- #read(path, **kwargs) ⇒ Object
Constructor Details
#initialize(parser) ⇒ Builder
Returns a new instance of Builder.
6 7 8 |
# File 'lib/csvreader/builder.rb', line 6 def initialize( parser ) @parser = parser end |
Instance Method Details
#config ⇒ Object
(auto-)forward to wrapped parser
note/fix: not all parser use/have config e.g. ParserTab, ParserFixed, etc.
todo/fix:
add parser config (attribute) setter e.g.
- sep=(value)
- comment=(value)
- and so on!!!
19 |
# File 'lib/csvreader/builder.rb', line 19 def config() @parser.config; end |
#foreach(path, **kwargs, &block) ⇒ Object
35 36 37 |
# File 'lib/csvreader/builder.rb', line 35 def foreach( path, **kwargs, &block ) CsvReader.foreach( path, parser: @parser, **kwargs, &block ) end |
#header(path, **kwargs) ⇒ Object
31 32 33 |
# File 'lib/csvreader/builder.rb', line 31 def header( path, **kwargs ) CsvReader.header( path, parser: @parser, **kwargs ) end |
#open(path, mode = nil, **kwargs, &block) ⇒ Object
23 24 25 |
# File 'lib/csvreader/builder.rb', line 23 def open( path, mode=nil, **kwargs, &block ) CsvReader.open( path, mode, parser: @parser, **kwargs, &block ) end |