Class: Apexgen::Field::Geolocation

Inherits:
Object
  • Object
show all
Defined in:
lib/apexgen/field/geolocation.rb

Instance Method Summary collapse

Instance Method Details

#format(name, o = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/apexgen/field/geolocation.rb', line 6

def format(name, o={})
  # Titleize the name so we don't need to repeat the method several times
  name_title = name.titleize
  # Set up default opts
  o[:externalId]               = o[:externalId]                || 'false'
  o[:trackHistory]             = o[:trackHistory]              || 'false'
  o[:required]                 = o[:required]                  || 'false'
  o[:displayLocationInDecimal] = o[:displayLocationInDecimal]  || 'false'
  o[:scale]                    = o[:scale]                     || '2'
  """
  <fields>
    <fullName>#{name_title.gsub(/\s/, '_')}__c</fullName>
    <description>#{name_title} Description</description>
    <displayLocationInDecimal>#{o[:displayLocationInDecimal]}</displayLocationInDecimal>
    <externalId>#{o[:externalId]}</externalId>
    <label>#{name_title}</label>
    <required>#{o[:required]}</required>
    <scale>#{o[:scale]}</scale>
    <trackHistory>#{o[:trackHistory]}</trackHistory>
    <type>Location</type>
  </fields>
  """
end