class Dataloaderb::ConfCreator

Attributes

processes[R]

Public Class Methods

new(yamls, opts = {}) click to toggle source

Create a new instance of a ConfCreator

# File lib/dataloaderb/conf_creator.rb, line 13
def initialize(yamls, opts = {})
  @processes = {}
  @opts      = opts
  build_process_definitions(yamls)
end

Public Instance Methods

build_process_definitions(yamls) click to toggle source
# File lib/dataloaderb/conf_creator.rb, line 19
def build_process_definitions(yamls)
  yamls.each do |yaml|
    if @opts[:merge].nil? || @opts[:merge].empty?
      proc_def = Dataloaderb::ProcessDefinition.new(yaml)
    else
      proc_def = Dataloaderb::ProcessDefinition.new(yaml, @opts[:merge])
    end
    process_name = proc_def.id
    @processes[process_name] = proc_def
  end
end
to_xml() click to toggle source

Return the text for an Apex Data Loader process-conf.xml file

# File lib/dataloaderb/conf_creator.rb, line 32
def to_xml
  # TODO: Don't unindent <%%
  erb = ERB.new File.new(File.expand_path('templates/process-conf.xml.erb',File.dirname(__FILE__))).readlines.join.gsub(/^\s+<%/, "<%"), nil, '<>'
  erb.result(get_binding)
end

Private Instance Methods

get_binding() click to toggle source
# File lib/dataloaderb/conf_creator.rb, line 40
def get_binding
  binding
end