Module: Kiba::Extend::Transforms::Helpers

Included in:
Clean::AlphabetizeFieldValues, Warn::UnevenFields
Defined in:
lib/kiba/extend/transforms/helpers.rb,
lib/kiba/extend/transforms/helpers/org_name_checker.rb,
lib/kiba/extend/transforms/helpers/delim_only_checker.rb,
lib/kiba/extend/transforms/helpers/field_value_getter.rb,
lib/kiba/extend/transforms/helpers/person_name_checker.rb,
lib/kiba/extend/transforms/helpers/field_evenness_checker.rb

Overview

utility functions across Transforms

Defined Under Namespace

Classes: DelimOnlyChecker, FieldEvennessChecker, FieldValueGetter, OrgNameChecker, PersonNameChecker

Class Method Summary collapse

Class Method Details

.empty?(val, usenull = false) ⇒ Boolean

Indicates whether a given value is empty, ignoring delimiters. If usenull is true, the config.nullvalue string is treated as empty

Parameters:

  • val (String)

    The field value to check

  • usenull (Boolean) (defaults to: false)

    If true, replaces config.nullvalue string with ‘’ to make determination

Returns:

  • (Boolean)


16
17
18
19
20
21
22
# File 'lib/kiba/extend/transforms/helpers.rb', line 16

def empty?(val, usenull = false)
  return true if val.nil?

  chkval = usenull ? val.gsub(Kiba::Extend.nullvalue, "") : val

  chkval.strip.empty?
end