Method: NetSuite::Records::CustomFieldList#method_missing

Defined in:
lib/netsuite/records/custom_field_list.rb

#method_missing(sym, *args, &block) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/netsuite/records/custom_field_list.rb', line 47

def method_missing(sym, *args, &block)
  # read custom field if already set
  if @custom_fields_assoc.include?(sym)
    return @custom_fields_assoc[sym]
  end

  # write custom field
  if sym.to_s.end_with?('=')
    field_name = sym.to_s[0..-2]
    delete_custom_field(field_name.to_sym)
    return create_custom_field(field_name, args.first)
  end

  super(sym, *args, &block)
end