Class: Locomotive::RelationalAlgebra::LiteralTable

Inherits:
Leaf show all
Defined in:
lib/locomotive/relational_algebra/operators/tables/literal_table.rb

Instance Attribute Summary collapse

Attributes inherited from Operator

#schema

Attributes included from AstHelpers::AstNode

#kind, #left_child, #owner, #right_child, #value

Instance Method Summary collapse

Methods inherited from Leaf

#set

Methods inherited from Operator

#bound, #free, #to_xml, #xml_schema

Methods included from XML

included, #quote, #to_xml

Methods included from AstHelpers::Annotations

#method_missing, #respond_to?

Methods included from AstHelpers::AstNode

#has_left_child?, #has_right_child?, #is_leaf?, #traverse, #traverse_strategy=

Constructor Details

#initialize(llist) ⇒ LiteralTable

Returns a new instance of LiteralTable.



70
71
72
# File 'lib/locomotive/relational_algebra/operators/tables/literal_table.rb', line 70

def initialize(llist)
  self.lit_list = to_literal_list llist
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Locomotive::AstHelpers::Annotations

Instance Attribute Details

#lit_list=(llist) ⇒ Object



47
48
49
50
51
52
53
# File 'lib/locomotive/relational_algebra/operators/tables/literal_table.rb', line 47

def lit_list=(llist)
  s = Hash[ *llist.collect do |attr, types|
                     [attr,types.collect { |a| a.type }.uniq]
                   end.flatten_once ]
  self.schema = Schema.new(s)
  @lit_list = llist
end

Instance Method Details

#cloneObject



84
85
86
# File 'lib/locomotive/relational_algebra/operators/tables/literal_table.rb', line 84

def clone
  LiteralTable.new( lit_list.clone )
end

#xml_contentObject



78
79
80
81
82
# File 'lib/locomotive/relational_algebra/operators/tables/literal_table.rb', line 78

def xml_content
  content do
    lit_list.to_xml
  end
end

#xml_kindObject



74
75
76
# File 'lib/locomotive/relational_algebra/operators/tables/literal_table.rb', line 74

def xml_kind
  :table
end