Module: Macros::Csv

Defined in:
lib/macros/csv.rb

Overview

Macros for extracting values from CSV rows

Instance Method Summary collapse

Instance Method Details

#normalize_prefixed_id(header_or_index) ⇒ Object


8
9
10
11
12
13
# File 'lib/macros/csv.rb', line 8

def normalize_prefixed_id(header_or_index)
  lambda do |row, accumulator, context|
    identifier = row[header_or_index].to_s.parameterize
    accumulator << identifier_with_prefix(context, identifier) if identifier.present?
  end
end