Class: CsvReader::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.



6
7
8
# File 'lib/csvreader/builder.rb', line 6

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


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

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



40
41
42
# File 'lib/csvreader/builder.rb', line 40

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

#read(path, **kwargs) ⇒ Object



27
28
29
# File 'lib/csvreader/builder.rb', line 27

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