Class: Twb::JoinTable

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, datasource = nil) ⇒ JoinTable

Returns a new instance of JoinTable.



394
395
396
397
398
399
400
# File 'lib/twb/datasource.rb', line 394

def initialize(name, datasource=nil)
  @name       = name
  @datasource = datasource
  # @str        = nil
  @children   = {}
  @depth      = 0
end

Instance Attribute Details

#childrenObject

Returns the value of attribute children.



392
393
394
# File 'lib/twb/datasource.rb', line 392

def children
  @children
end

#datasourceObject (readonly)

, :str



391
392
393
# File 'lib/twb/datasource.rb', line 391

def datasource
  @datasource
end

#depthObject

Returns the value of attribute depth.



392
393
394
# File 'lib/twb/datasource.rb', line 392

def depth
  @depth
end

#nameObject (readonly)

, :str



391
392
393
# File 'lib/twb/datasource.rb', line 391

def name
  @name
end

Instance Method Details

#<=>(anOther) ⇒ Object



408
409
410
# File 'lib/twb/datasource.rb', line 408

def <=>(anOther)
  @str <=> anOther.str
end

#addChild(child) ⇒ Object



412
413
414
415
416
417
# File 'lib/twb/datasource.rb', line 412

def addChild child
  # puts "#{@name}.addChild(#{child.name})"
  # puts "children: #{@children}"
  @children[child.name] = child if @children[child.name].nil?
  # puts "children: #{@children}"
end

#child(name) ⇒ Object



419
420
421
# File 'lib/twb/datasource.rb', line 419

def child name
  @children[name]
end

#to_sObject



402
403
404
405
406
# File 'lib/twb/datasource.rb', line 402

def to_s
  str = "[#{@datasource}].[#{@name}] :: (#{@depth}) :: #{@children.length} :: "
  @children.each { |n,c| str << "#{n}, " }
  return str
end