Class: Twb::Field

Inherits:
TabClass show all
Defined in:
lib/twb/field.rb

Instance Attribute Summary collapse

Attributes inherited from TabClass

#properties, #ttlogfile, #ttlogfilename, #uuid

Instance Method Summary collapse

Methods inherited from TabClass

#docFile, #emit, #setDocFileName

Constructor Details

#initialize(fieldNode) ⇒ Field

Returns a new instance of Field.


24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/twb/field.rb', line 24

def initialize fieldNode
  @node        = fieldNode
  @name        = @node.attr('name')
  @datatype    = @node.attr('datatype')
  @role        = @node.attr('role')
  @type        = @node.attr('type')
  @hidden      = @node.attr('hidden')
  @caption     = @node.attr('caption')
  @aggregation = @node.attr('aggregation')
  @uiname      = if @caption.nil? || @caption == '' then @name.gsub(/^\[/,'').gsub(/\]$/,'') else @caption end
  #puts "\t\t - n:#{@name} \t  c:#{@caption} \t  n:#{@uiname}"
  return self
end

Instance Attribute Details

#aggregationObject (readonly)

Returns the value of attribute aggregation


22
23
24
# File 'lib/twb/field.rb', line 22

def aggregation
  @aggregation
end

#captionObject (readonly)

Returns the value of attribute caption


22
23
24
# File 'lib/twb/field.rb', line 22

def caption
  @caption
end

#datatypeObject (readonly)

Returns the value of attribute datatype


22
23
24
# File 'lib/twb/field.rb', line 22

def datatype
  @datatype
end

#hiddenObject (readonly)

Returns the value of attribute hidden


22
23
24
# File 'lib/twb/field.rb', line 22

def hidden
  @hidden
end

#nameObject (readonly)

Returns the value of attribute name


22
23
24
# File 'lib/twb/field.rb', line 22

def name
  @name
end

#nodeObject (readonly)

Returns the value of attribute node


22
23
24
# File 'lib/twb/field.rb', line 22

def node
  @node
end

#roleObject (readonly)

Returns the value of attribute role


22
23
24
# File 'lib/twb/field.rb', line 22

def role
  @role
end

#typeObject (readonly)

Returns the value of attribute type


22
23
24
# File 'lib/twb/field.rb', line 22

def type
  @type
end

#uinameObject (readonly)

Returns the value of attribute uiname


22
23
24
# File 'lib/twb/field.rb', line 22

def uiname
  @uiname
end

Instance Method Details

#idObject


38
39
40
# File 'lib/twb/field.rb', line 38

def id
    @id ||= @id = @name.hash
end