Class: GnCrossmap::Reader
- Inherits:
-
Object
- Object
- GnCrossmap::Reader
- Defined in:
- lib/gn_crossmap/reader.rb
Overview
Reads supplied csv file and creates ruby structure to compare with a Global Names Resolver source
Instance Attribute Summary collapse
-
#col_sep ⇒ Object
readonly
Returns the value of attribute col_sep.
-
#original_fields ⇒ Object
readonly
Returns the value of attribute original_fields.
Instance Method Summary collapse
-
#initialize(csv_io, input_name, skip_original, alt_headers, stats) ⇒ Reader
constructor
A new instance of Reader.
- #read ⇒ Object
Constructor Details
#initialize(csv_io, input_name, skip_original, alt_headers, stats) ⇒ Reader
Returns a new instance of Reader.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/gn_crossmap/reader.rb', line 9 def initialize(csv_io, input_name, skip_original, alt_headers, stats) @stats = stats @alt_headers = alt_headers @csv_io = csv_io @col_sep = detect_col_sep @quote_char = quote_char(@col_sep) @original_fields = nil @input_name = input_name @skip_original = skip_original end |
Instance Attribute Details
#col_sep ⇒ Object (readonly)
Returns the value of attribute col_sep.
7 8 9 |
# File 'lib/gn_crossmap/reader.rb', line 7 def col_sep @col_sep end |
#original_fields ⇒ Object (readonly)
Returns the value of attribute original_fields.
7 8 9 |
# File 'lib/gn_crossmap/reader.rb', line 7 def original_fields @original_fields end |
Instance Method Details
#read ⇒ Object
20 21 22 23 24 25 |
# File 'lib/gn_crossmap/reader.rb', line 20 def read @stats.stats[:ingestion_start] = Time.now @stats.stats[:status] = :ingestion GnCrossmap.log("Read input from #{@input_name}") block_given? ? parse_input(&Proc.new) : parse_input end |