Method: Fech::Filing#parse_row?

Defined in:
lib/fech/filing.rb

#parse_row?(row, opts = {}) ⇒ Boolean

Decides what to do with a given row. If the row’s type matches the desired type, or if no type was specified, it will run the row through #map. If :raw was passed true, a flat, unmapped data array will be returned.

Parameters:

  • row (String, Regexp)

    a partial or complete name of the type of row desired

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

    a customizable set of options

Options Hash (opts):

  • :include (Array)

    list of field names that should be included in the returned hash

Returns:

  • (Boolean)


99
100
101
102
103
104
105
106
107
108
109
# File 'lib/fech/filing.rb', line 99

def parse_row?(row, opts={})
  return false if row.nil? || row.empty?

  # Always parse, unless :parse_if is given and does not match row
  if opts[:parse_if].nil? || \
      Fech.regexify(opts[:parse_if]).match(row.first.downcase)
    opts[:raw] ? row : map(row, opts)
  else
    false
  end
end