Class: CsvPiper::Builder
- Inherits:
-
Object
- Object
- CsvPiper::Builder
- Defined in:
- lib/csv_piper/builder.rb
Instance Method Summary collapse
- #build ⇒ Object
- #from(io_stream) ⇒ Object
-
#initialize ⇒ Builder
constructor
A new instance of Builder.
- #requires_headers(headers) ⇒ Object
- #with_csv_options(options) ⇒ Object
- #with_pre_processors(pre_processors) ⇒ Object
- #with_processors(processors) ⇒ Object
Constructor Details
#initialize ⇒ Builder
Returns a new instance of Builder.
3 4 5 6 |
# File 'lib/csv_piper/builder.rb', line 3 def initialize @pre_processors = [] @processors = [] end |
Instance Method Details
#build ⇒ Object
33 34 35 36 37 38 |
# File 'lib/csv_piper/builder.rb', line 33 def build = { io_stream: @io, pre_processors: @pre_processors, processors: @processors } [:csv_options] = @csv_options if @csv_options [:required_headers] = @required_headers if @required_headers Piper.new() end |
#from(io_stream) ⇒ Object
8 9 10 11 |
# File 'lib/csv_piper/builder.rb', line 8 def from(io_stream) @io = io_stream self end |
#requires_headers(headers) ⇒ Object
28 29 30 31 |
# File 'lib/csv_piper/builder.rb', line 28 def requires_headers(headers) @required_headers = headers self end |
#with_csv_options(options) ⇒ Object
23 24 25 26 |
# File 'lib/csv_piper/builder.rb', line 23 def () @csv_options = self end |
#with_pre_processors(pre_processors) ⇒ Object
13 14 15 16 |
# File 'lib/csv_piper/builder.rb', line 13 def with_pre_processors(pre_processors) @pre_processors += pre_processors self end |
#with_processors(processors) ⇒ Object
18 19 20 21 |
# File 'lib/csv_piper/builder.rb', line 18 def with_processors(processors) @processors += processors self end |