Class: Twb::GroupField

Inherits:
Object
  • Object
show all
Includes:
TabTool
Defined in:
lib/twb/groupfield.rb

Overview

module Data

Instance Attribute Summary collapse

Attributes included from TabTool

#alerts, #docDir, #docfiles, #funcdoc, #licensed, #logfilename, #logger, #loglevel, #metrics, #ttdocdir, #type, #uuid

Instance Method Summary collapse

Methods included from TabTool

#addDocFile, #alert, #closeDocFiles, #config, #docFile, #docFileMaxNameLen, #docfilesdoc, #docfilesdocto_s, #emit, #emitCSV, #finis, #hasConfig, #init, #initCSV, #initDocDir, #initLogger, #license=, #licensed?, #loadConfig

Constructor Details

#initialize(node) ⇒ GroupField

Returns a new instance of GroupField.



28
29
30
31
32
33
# File 'lib/twb/groupfield.rb', line 28

def initialize node
  @node        = node
  @caption     = @node['caption']
  @name        = @node['name'].gsub(/^\[|\]$/,'')
  @uiname      = @caption.nil? ? @name : @caption
end

Instance Attribute Details

#captionObject (readonly)

Returns the value of attribute caption.



26
27
28
# File 'lib/twb/groupfield.rb', line 26

def caption
  @caption
end

#nameObject (readonly)

Returns the value of attribute name.



26
27
28
# File 'lib/twb/groupfield.rb', line 26

def name
  @name
end

#nodeObject (readonly)

Returns the value of attribute node.



25
26
27
# File 'lib/twb/groupfield.rb', line 25

def node
  @node
end

#uinameObject (readonly)

Returns the value of attribute uiname.



26
27
28
# File 'lib/twb/groupfield.rb', line 26

def uiname
  @uiname
end

Instance Method Details

#idObject



35
36
37
# File 'lib/twb/groupfield.rb', line 35

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

#loadPropertiesObject



43
44
45
46
47
48
49
50
# File 'lib/twb/groupfield.rb', line 43

def loadProperties
  @properties= {}
  @node.attributes.each do |name,attr|
    @properties[name] = attr.value
  end
  @properties[:uiname] = @name
  return @properties
end

#propertiesObject



39
40
41
# File 'lib/twb/groupfield.rb', line 39

def properties
  @properties ||= loadProperties
end