Class: VarListener

Inherits:
Listener
  • Object
show all
Defined in:
lib/xmlutils/varlistener.rb

Overview

class VarListener

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ctx) ⇒ VarListener

————————————————————————————————————-# initialize - Ctor

ctx - Context object to store variables in

————————————————————————————————————#



36
37
38
39
# File 'lib/xmlutils/varlistener.rb', line 36

def initialize(ctx)
  @verbose    = false
  @context    = ctx
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



25
26
27
# File 'lib/xmlutils/varlistener.rb', line 25

def context
  @context
end

Instance Method Details

#openDPM(attributes) ⇒ Object

————————————————————————————————————-# openDPM - Add a DPM variable to the context object

attributes - DPM element attributes

————————————————————————————————————#



50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/xmlutils/varlistener.rb', line 50

def openDPM(attributes)
  dpmAlias  = attributes["Name"]
  confName  = @context.createValidName(dpmAlias)
  varType   = attributes["Type"]
  dataType  = attributes["DataType"] if attributes.has_key?("DataType")
  prodType  = attributes["ProductType"]

  dataType = prodType if nil == dataType

  dpm = Dpm.new(confName, dpmAlias, varType, dataType, prodType)

  @context.dpms[dpmAlias] = dpm
end

#openPPM(attributes) ⇒ Object

————————————————————————————————————-# openPPM - Add a PPM variable to the context object

attributes - PPM element attributes

————————————————————————————————————#



73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/xmlutils/varlistener.rb', line 73

def openPPM(attributes)
  ppmAlias  = attributes["Name"]
  confName  = @context.createValidName(ppmAlias)
  varType   = attributes["Type"]
  dataType  = attributes["DataType"] if attributes.has_key?("DataType")

  dataType = "Text" if nil == dataType

  ppm = Ppm.new(confName, ppmAlias, varType, dataType)

  @context.ppms[ppmAlias] = ppm
end