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.



584
585
586
587
588
589
590
# File 'lib/twb/datasource.rb', line 584

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.



582
583
584
# File 'lib/twb/datasource.rb', line 582

def children
  @children
end

#datasourceObject (readonly)

, :str



581
582
583
# File 'lib/twb/datasource.rb', line 581

def datasource
  @datasource
end

#depthObject

Returns the value of attribute depth.



582
583
584
# File 'lib/twb/datasource.rb', line 582

def depth
  @depth
end

#nameObject (readonly)

, :str



581
582
583
# File 'lib/twb/datasource.rb', line 581

def name
  @name
end

Instance Method Details

#<=>(anOther) ⇒ Object



598
599
600
# File 'lib/twb/datasource.rb', line 598

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

#addChild(child) ⇒ Object



602
603
604
605
606
607
# File 'lib/twb/datasource.rb', line 602

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



609
610
611
# File 'lib/twb/datasource.rb', line 609

def child name
  @children[name]
end

#to_sObject



592
593
594
595
596
# File 'lib/twb/datasource.rb', line 592

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