Class: DataSource

Inherits:
Object
  • Object
show all
Defined in:
lib/datasource.rb

Constant Summary collapse

@@hasher =
Digest::SHA256.new

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dataSourceNode) ⇒ DataSource

Returns a new instance of DataSource.



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

def initialize dataSourceNode
  @node    = dataSourceNode
  @name    = @node.xpath('./@name').text
  @caption = @node.xpath('./@caption').text
  @uiname  = if @caption.nil? || @caption == '' then @name else @caption end
  # puts "DS:        n:#{@name}"
  # puts "     caption:#{@caption}"
  # puts "      c.len :#{@caption.length}"
  # puts "      c.nil?:#{@caption.nil?}"
  # puts "      uiname:#{@uiname}"
  # puts " "
  processConnection
end

Instance Attribute Details

#captionObject (readonly)

Returns the value of attribute caption.



23
24
25
# File 'lib/datasource.rb', line 23

def caption
  @caption
end

#classObject (readonly)

Returns the value of attribute class.



23
24
25
# File 'lib/datasource.rb', line 23

def class
  @class
end

#connectionObject (readonly)

Returns the value of attribute connection.



23
24
25
# File 'lib/datasource.rb', line 23

def connection
  @connection
end

#connHashObject (readonly)

Returns the value of attribute connHash.



23
24
25
# File 'lib/datasource.rb', line 23

def connHash
  @connHash
end

#nameObject (readonly)

Returns the value of attribute name.



23
24
25
# File 'lib/datasource.rb', line 23

def name
  @name
end

#nodeObject (readonly)

Returns the value of attribute node.



23
24
25
# File 'lib/datasource.rb', line 23

def node
  @node
end

#uinameObject (readonly)

Returns the value of attribute uiname.



23
24
25
# File 'lib/datasource.rb', line 23

def uiname
  @uiname
end

Instance Method Details

#processConnectionObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/datasource.rb', line 39

def processConnection
  @connHash    = ''
  @connection  = @node.at_xpath('./connection')
  if !@connection.nil? then
    @class       = @connection.attribute('class').text
    dsAttributes = @node.xpath('./connection/@*')
    dsConnStr  = ''
    dsAttributes.each do |attr|
      dsConnStr += attr.text
      # Note: only collects non-'' attribute values
    end
    @connHash = Digest::MD5.hexdigest(dsConnStr)
  end
end