Class: ParseDecision::Plugin::Application

Inherits:
Plugin
  • Object
show all
Defined in:
lib/parse_decision/plugin/application.rb

Overview

####################################################################### Application XML plugin

Instance Method Summary collapse

Methods inherited from Plugin

#apply_template, #apply_templates, #write_to_file

Constructor Details

#initializeApplication

Returns a new instance of Application.



19
20
21
22
23
24
# File 'lib/parse_decision/plugin/application.rb', line 19

def initialize()
  $LOG.debug "Application::initialize"
  @fnameTemplate = "@[email protected]"
  @searchStr = "<DECISION_REQUEST><APPLICATION"
  @searchStr = "<APPLICATION "            # Note that the space at end is required.
end

Instance Method Details

#execute(context, ln) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/parse_decision/plugin/application.rb', line 26

def execute(context, ln)
 #$LOG.debug "Application::execute"
  if(ln.include?(@searchStr))
    context.nextIndex
    context.state = :app
    outfile = apply_template(@fnameTemplate, "@INDEX@", context.indexStr)
    puts "" if context.verbose
    puts "= = = = = = = = = = = = = = = = = = = = = = = = = = = =" if context.verbose
    puts "" if context.verbose
    puts "Creating Application XML file: #{outfile}" if context.verbose
    File.open(context.outputPath(outfile), "w") do |f|
      write_to_file(f,ln)
    end
    return true
  end
  return false
end