Module: BulkOps::InterpretOptionsBehavior

Extended by:
ActiveSupport::Concern
Included in:
Parser
Defined in:
lib/concerns/interpret_options_behavior.rb

Instance Method Summary collapse

Instance Method Details

#interpret_option_fieldsObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/concerns/interpret_options_behavior.rb', line 5

def interpret_option_fields
  @raw_row.each do |field,value|
    next if value.blank? or field.blank?
    field = field.to_s
    next if value == field

    normfield = field.downcase.parameterize.gsub(/[_\s-]/,'')
    if ["visibility", "public"].include?(normfield)
      @proxy.update(visibility: format_visibility(value))

    end
    if ["worktype","model","type"].include?(normfield)
      @proxy.update(work_type: format_worktype(value) )
    end
    if ["referenceidentifier", 
        "referenceid", 
        "refid",
        "referenceidentifiertype", 
        "referenceidtype", 
        "refidtype", 
        "relationshipidentifier",
        "relationshipid",
        "relationshipidentifiertype",
        "relationshipidtype",
        "relid",
        "relidtype"].include?(normfield)
      @proxy.update(reference_identifier: format_reference_id(value))
    end
  end
end