Class: Locomotive::RelationalAlgebra::Attach

Inherits:
Unary show all
Defined in:
lib/locomotive/relational_algebra/operators/projections/attach.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 Operator

#bound, #free, #to_xml, #xml_kind, #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(op, item) ⇒ Attach

Returns a new instance of Attach.



37
38
39
40
# File 'lib/locomotive/relational_algebra/operators/projections/attach.rb', line 37

def initialize(op, item)
  self.item = item
  super(op)
end

Dynamic Method Handling

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

Instance Attribute Details

#itemObject

Returns the value of attribute item.



34
35
36
# File 'lib/locomotive/relational_algebra/operators/projections/attach.rb', line 34

def item
  @item
end

Instance Method Details

#child=(op) ⇒ Object



42
43
44
45
46
# File 'lib/locomotive/relational_algebra/operators/projections/attach.rb', line 42

def child=(op)
  self.schema = op.schema +
           Schema.new({ item.attribute => [item.atom.type] })
  super(op)
end

#cloneObject



54
55
56
# File 'lib/locomotive/relational_algebra/operators/projections/attach.rb', line 54

def clone
  Attach.new(child.clone, item.clone)
end

#set(var, plan) ⇒ Object



58
59
60
61
62
# File 'lib/locomotive/relational_algebra/operators/projections/attach.rb', line 58

def set(var, plan)
  Attach.new(
    child.set(var,plan),
    item.clone)
end

#xml_contentObject



48
49
50
51
52
# File 'lib/locomotive/relational_algebra/operators/projections/attach.rb', line 48

def xml_content
  content do
    item.to_xml
  end
end