Method: Rsmart::ETL.parse_integer!

Defined in:
lib/rsmart_toolbox/etl.rb

.parse_integer!(row, insert_str, values_str, opt = {}) ⇒ void

This method returns an undefined value.

Helper method which finds the value by column :name and mutates the SQL statement accordingly.

Parameters:

  • row (CSV::Row)

    the CSV Row being parsed

  • insert_str (String)

    the left side of the insert statement (i.e. columns)

  • values_str (String)

    the right side of the insert statement (i.e. values)

  • opt (Hash) (defaults to: {})

    options Hash will be passed through to #parse_integer.

Options Hash (opt):

  • :name (String)

    the name of the field being parsed. Required.

Raises:

  • (ArgumentError)

    :name is required.

See Also:



242
243
244
245
246
# File 'lib/rsmart_toolbox/etl.rb', line 242

def self.parse_integer!(row, insert_str, values_str, opt={})
  raise ArgumentError, "opt[:name] is required!" unless opt[:name]
  i = parse_integer( row[ to_symbol( opt[:name] ) ], opt )
  mutate_sql_stmt! insert_str, opt[:name], values_str, i
end