Class: ParseDecision::Plugin::PpmXpath
- Defined in:
- lib/parse_decision/plugin/ppm_xpath.rb
Overview
####################################################################### PPM XPath plugin
Instance Method Summary collapse
- #execute(context, ln) ⇒ Object
-
#initialize ⇒ PpmXpath
constructor
A new instance of PpmXpath.
- #is_ppm_xpath(context, ln) ⇒ Object
- #store_xpath_content(context, ln) ⇒ Object
Methods inherited from Plugin
#apply_template, #apply_templates, #write_to_file
Constructor Details
#initialize ⇒ PpmXpath
Returns a new instance of PpmXpath.
19 20 21 22 23 24 |
# File 'lib/parse_decision/plugin/ppm_xpath.rb', line 19 def initialize() $LOG.debug "PpmXpath::initialize" @fnameTemplate = "@[email protected]" @searchStr1 = "*APP XPATH xml*" @searchStr2 = "<PPXPATH>" end |
Instance Method Details
#execute(context, ln) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/parse_decision/plugin/ppm_xpath.rb', line 26 def execute(context, ln) #$LOG.debug "PpmXpath::execute" #require 'pry'; binding.pry case context.state when :app return is_ppm_xpath context, ln when :appPpmXpath return store_xpath_content context, ln else return false end # case end |
#is_ppm_xpath(context, ln) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/parse_decision/plugin/ppm_xpath.rb', line 41 def is_ppm_xpath(context,ln) if ln.include?(@searchStr1) context.state = :appPpmXpath return true end return false end |
#store_xpath_content(context, ln) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/parse_decision/plugin/ppm_xpath.rb', line 49 def store_xpath_content(context, ln) if ln.include?(@searchStr2) context.state = :app outfile = apply_template(@fnameTemplate, "@INDEX@", context.indexStr) puts "Creating App XML XPath file: #{outfile}" if context.verbose File.open(context.outputPath(outfile), "w") do |f| write_to_file(f,ln) end return true end # This is probably an empty line. # Return true since we're in the xpath state and there is no need for # any other plugin to handle this line. return true end |