Class: Sycsvpro::Header
- Includes:
- Dsl
- Defined in:
- lib/sycsvpro/header.rb
Overview
Creates a header
Instance Attribute Summary collapse
-
#header_cols ⇒ Object
readonly
Header columns.
Attributes inherited from Filter
#date_format, #filter, #pattern, #pivot, #types
Instance Method Summary collapse
-
#initialize(header) ⇒ Header
constructor
Create a new header.
-
#process(line) ⇒ Object
Returns the header.
Methods included from Dsl
#rows, #str2utf8, #unstring, #write_to
Methods inherited from Filter
#has_filter?, #method_missing, #pivot_each_column
Constructor Details
#initialize(header) ⇒ Header
Create a new header
16 17 18 19 20 21 22 |
# File 'lib/sycsvpro/header.rb', line 16 def initialize(header) unless header.nil? or header.empty? @header_cols = header.split(',') else @header_cols = [] end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Sycsvpro::Filter
Instance Attribute Details
#header_cols ⇒ Object (readonly)
Header columns
13 14 15 |
# File 'lib/sycsvpro/header.rb', line 13 def header_cols @header_cols end |
Instance Method Details
#process(line) ⇒ Object
Returns the header
25 26 27 28 29 |
# File 'lib/sycsvpro/header.rb', line 25 def process(line) return "" if @header_cols.empty? @header_cols[0] = unstring(line).split(';') @header_cols.flatten.join(';') end |