class ParseDecision::Plugin::ProductXpath

#######################################################################

Product XPath plugin

Public Class Methods

new() click to toggle source
# File lib/parse_decision/plugin/product_xpath.rb, line 19
def initialize()
    $LOG.debug "ProductXpath::initialize"
  @searchStr1 = "*PRODUCT XPATH xml*"
  @searchStr2 = "<PPXPATH>"
end

Public Instance Methods

execute(context, ln) click to toggle source
# File lib/parse_decision/plugin/product_xpath.rb, line 25
def execute(context, ln)
    #$LOG.debug "ProductXpath::execute"
  if((context.state == :app) && ln.include?(@searchStr1))
    context.state = :productXpath
    return true
  end

  if((context.state == :productXpath) && ln.include?(@searchStr2))
    context.state = :app
    # We just store the product xpath in the context so it can
    # be incorporated into the product rules file later.
    context[:productXpath] = ln
    return true
  end

  if(context.state == :productXpath)
    # Probably a blank line. Claim it so we don't waste anyone else's time.
    return true
  end

  return false
end