Class: Twb::CalculatedField
- Inherits:
-
Object
- Object
- Twb::CalculatedField
- Defined in:
- lib/twb/calculatedfield.rb
Instance Attribute Summary collapse
-
#calcFields ⇒ Object
readonly
Returns the value of attribute calcFields.
-
#calculation ⇒ Object
readonly
Returns the value of attribute calculation.
-
#caption ⇒ Object
readonly
Returns the value of attribute caption.
-
#dataSource ⇒ Object
readonly
Returns the value of attribute dataSource.
-
#datatype ⇒ Object
readonly
Returns the value of attribute datatype.
-
#hidden ⇒ Object
readonly
Returns the value of attribute hidden.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
-
#role ⇒ Object
readonly
Returns the value of attribute role.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#uiname ⇒ Object
readonly
Returns the value of attribute uiname.
Instance Method Summary collapse
- #calcLines ⇒ Object
- #formulaLines ⇒ Object
- #formulaResolved ⇒ Object
- #formulaResolvedLines ⇒ Object
-
#initialize(calcNode, datasource = nil) ⇒ CalculatedField
constructor
A new instance of CalculatedField.
- #loadProperties ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(calcNode, datasource = nil) ⇒ CalculatedField
Returns a new instance of CalculatedField.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/twb/calculatedfield.rb', line 29 def initialize(calcNode, datasource=nil) @node = calcNode @dataSource = datasource # -- @caption = calcNode.attribute('caption').text if calcNode.has_attribute?('caption') @name = calcNode.attribute('name').text.gsub(/^\[/,'').gsub(/\]$/,'') @uiname = caption.nil? ? @name : @caption # -- @datatype = @node.attribute('datatype').text @role = @node.attribute('role').text @type = @node.attribute('type').text # -- @calculation = Twb::FieldCalculation.new(self, datasource) # -- @hidden = true if calcNode.has_attribute?('caption') end |
Instance Attribute Details
#calcFields ⇒ Object (readonly)
Returns the value of attribute calcFields.
26 27 28 |
# File 'lib/twb/calculatedfield.rb', line 26 def calcFields @calcFields end |
#calculation ⇒ Object (readonly)
Returns the value of attribute calculation.
26 27 28 |
# File 'lib/twb/calculatedfield.rb', line 26 def calculation @calculation end |
#caption ⇒ Object (readonly)
Returns the value of attribute caption.
24 25 26 |
# File 'lib/twb/calculatedfield.rb', line 24 def caption @caption end |
#dataSource ⇒ Object (readonly)
Returns the value of attribute dataSource.
22 23 24 |
# File 'lib/twb/calculatedfield.rb', line 22 def dataSource @dataSource end |
#datatype ⇒ Object (readonly)
Returns the value of attribute datatype.
25 26 27 |
# File 'lib/twb/calculatedfield.rb', line 25 def datatype @datatype end |
#hidden ⇒ Object (readonly)
Returns the value of attribute hidden.
27 28 29 |
# File 'lib/twb/calculatedfield.rb', line 27 def hidden @hidden end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
24 25 26 |
# File 'lib/twb/calculatedfield.rb', line 24 def name @name end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
23 24 25 |
# File 'lib/twb/calculatedfield.rb', line 23 def node @node end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
23 24 25 |
# File 'lib/twb/calculatedfield.rb', line 23 def properties @properties end |
#role ⇒ Object (readonly)
Returns the value of attribute role.
25 26 27 |
# File 'lib/twb/calculatedfield.rb', line 25 def role @role end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
25 26 27 |
# File 'lib/twb/calculatedfield.rb', line 25 def type @type end |
#uiname ⇒ Object (readonly)
Returns the value of attribute uiname.
24 25 26 |
# File 'lib/twb/calculatedfield.rb', line 24 def uiname @uiname end |
Instance Method Details
#calcLines ⇒ Object
50 51 52 |
# File 'lib/twb/calculatedfield.rb', line 50 def calcLines @calculation.calcFields end |
#formulaLines ⇒ Object
54 55 56 |
# File 'lib/twb/calculatedfield.rb', line 54 def formulaLines @calculation.formulaLines end |
#formulaResolved ⇒ Object
62 63 64 |
# File 'lib/twb/calculatedfield.rb', line 62 def formulaResolved @calculation.formulaResolved end |
#formulaResolvedLines ⇒ Object
58 59 60 |
# File 'lib/twb/calculatedfield.rb', line 58 def formulaResolvedLines @calculation.formulaResolvedLines end |
#loadProperties ⇒ Object
66 67 68 69 70 71 72 73 |
# File 'lib/twb/calculatedfield.rb', line 66 def loadProperties @properties= {} @node.attributes.each do |name,attr| @properties[name] = attr.value end @properties[:uiname] = @uiname return @properties end |
#to_s ⇒ Object
75 76 77 |
# File 'lib/twb/calculatedfield.rb', line 75 def to_s "%s(%s) => %s" % [uiname, name, @calculation.formulaFlat] end |