Class: Twb::CalculatedField
- Inherits:
-
Object
- Object
- Twb::CalculatedField
- Defined in:
- lib/twb/calculatedfield.rb
Instance Attribute Summary collapse
-
#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.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#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
-
#initialize(calcNode, datasource = nil) ⇒ CalculatedField
constructor
A new instance of CalculatedField.
- #to_s ⇒ Object
Constructor Details
#initialize(calcNode, datasource = nil) ⇒ CalculatedField
Returns a new instance of CalculatedField.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/twb/calculatedfield.rb', line 27 def initialize(calcNode, datasource=nil) @dataSource = datasource @node = calcNode # -- @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) end |
Instance Attribute Details
#calculation ⇒ Object (readonly)
Returns the value of attribute calculation.
25 26 27 |
# File 'lib/twb/calculatedfield.rb', line 25 def calculation @calculation end |
#caption ⇒ Object (readonly)
Returns the value of attribute caption.
23 24 25 |
# File 'lib/twb/calculatedfield.rb', line 23 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.
24 25 26 |
# File 'lib/twb/calculatedfield.rb', line 24 def datatype @datatype end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
23 24 25 |
# File 'lib/twb/calculatedfield.rb', line 23 def name @name end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
22 23 24 |
# File 'lib/twb/calculatedfield.rb', line 22 def node @node end |
#role ⇒ Object (readonly)
Returns the value of attribute role.
24 25 26 |
# File 'lib/twb/calculatedfield.rb', line 24 def role @role end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
24 25 26 |
# File 'lib/twb/calculatedfield.rb', line 24 def type @type end |
#uiname ⇒ Object (readonly)
Returns the value of attribute uiname.
23 24 25 |
# File 'lib/twb/calculatedfield.rb', line 23 def uiname @uiname end |
Instance Method Details
#to_s ⇒ Object
42 43 44 |
# File 'lib/twb/calculatedfield.rb', line 42 def to_s "%s(%s) => %s" % [uiname, name, @calculation.formulaFlat] end |