Class: CsvHashReader::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/csvreader/builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(parser) ⇒ Builder

Returns a new instance of Builder.



50
51
52
# File 'lib/csvreader/builder.rb', line 50

def initialize( parser )
  @parser = parser
end

Instance Method Details

#configObject

(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!!!


62
# File 'lib/csvreader/builder.rb', line 62

def config() @parser.config; end

#foreach(path, **kwargs, &block) ⇒ Object



74
75
76
# File 'lib/csvreader/builder.rb', line 74

def foreach( path, **kwargs, &block )
  CsvHashReader.foreach( path, parser: @parser, **kwargs, &block )
end

#open(path, mode = nil, **kwargs, &block) ⇒ Object



66
67
68
# File 'lib/csvreader/builder.rb', line 66

def open( path, mode=nil, **kwargs, &block )
  CsvHashReader.open( path, mode, parser: @parser, **kwargs, &block )
end

#parse(str_or_readable, **kwargs, &block) ⇒ Object



79
80
81
# File 'lib/csvreader/builder.rb', line 79

def parse( str_or_readable, **kwargs, &block )
  CsvHashReader.parse( str_or_readable, parser: @parser, **kwargs, &block )
end

#read(path, **kwargs) ⇒ Object



70
71
72
# File 'lib/csvreader/builder.rb', line 70

def read( path, **kwargs )
  CsvHashReader.read( path, parser: @parser, **kwargs )
end