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.



626
627
628
629
630
631
632
# File 'lib/twb/datasource.rb', line 626

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.



624
625
626
# File 'lib/twb/datasource.rb', line 624

def children
  @children
end

#datasourceObject (readonly)

, :str



623
624
625
# File 'lib/twb/datasource.rb', line 623

def datasource
  @datasource
end

#depthObject

Returns the value of attribute depth.



624
625
626
# File 'lib/twb/datasource.rb', line 624

def depth
  @depth
end

#nameObject (readonly)

, :str



623
624
625
# File 'lib/twb/datasource.rb', line 623

def name
  @name
end

Instance Method Details

#<=>(anOther) ⇒ Object



640
641
642
# File 'lib/twb/datasource.rb', line 640

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

#addChild(child) ⇒ Object



644
645
646
647
648
649
# File 'lib/twb/datasource.rb', line 644

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



651
652
653
# File 'lib/twb/datasource.rb', line 651

def child name
  @children[name]
end

#to_sObject



634
635
636
637
638
# File 'lib/twb/datasource.rb', line 634

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