Class: Dataloaderb::ConfCreator
- Inherits:
-
Object
- Object
- Dataloaderb::ConfCreator
- Defined in:
- lib/dataloaderb/conf_creator.rb
Instance Attribute Summary (collapse)
-
- (Object) processes
readonly
Returns the value of attribute processes.
Instance Method Summary (collapse)
- - (Object) build_process_definitions(yamls)
-
- (ConfCreator) initialize(yamls, opts = {})
constructor
Create a new instance of a ConfCreator.
-
- (Object) to_xml
Return the text for an Apex Data Loader process-conf.xml file.
Constructor Details
- (ConfCreator) initialize(yamls, opts = {})
Create a new instance of a ConfCreator
13 14 15 16 17 |
# File 'lib/dataloaderb/conf_creator.rb', line 13 def initialize(yamls, opts = {}) @processes = {} @opts = opts build_process_definitions(yamls) end |
Instance Attribute Details
- (Object) processes (readonly)
Returns the value of attribute processes
10 11 12 |
# File 'lib/dataloaderb/conf_creator.rb', line 10 def processes @processes end |
Instance Method Details
- (Object) build_process_definitions(yamls)
19 20 21 22 23 24 25 26 27 28 29 |
# 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 |
- (Object) to_xml
Return the text for an Apex Data Loader process-conf.xml file
32 33 34 35 36 |
# File 'lib/dataloaderb/conf_creator.rb', line 32 def to_xml # TODO: Don't unindent <%% erb = ERB.new File.new(File.('templates/process-conf.xml.erb',File.dirname(__FILE__))).readlines.join.gsub(/^\s+<%/, "<%"), nil, '<>' erb.result(get_binding) end |