Class: Apexgen::Field::Url

Inherits:
Object
  • Object
show all
Defined in:
lib/apexgen/field/url.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
# File 'lib/apexgen/field/url.rb', line 6

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