Class: Alf::Algebra::Wrap

Inherits:
Object
  • Object
show all
Includes:
Operator, Relational, Unary
Defined in:
lib/alf/algebra/operator/wrap.rb

Instance Attribute Summary

Attributes included from Operator

#operands

Instance Method Summary collapse

Methods included from Unary

included, #operand, #with_operand

Methods included from Relational

included

Methods included from Support::Registry

#each, #listen, #listeners, #register, #registered

Methods included from Operator

#==, #dup, #hash, included, #initialize, #signature, #to_cog, #to_lispy, #to_relvar, #to_s, #type_check, #with_operands

Methods included from TypeCheck

#joinable_headings!, #no_name_clash!, #same_heading!, #type_check_error!, #valid_ordering!

Methods included from Operand

#attr_list, coerce, #resulting_type, #to_ascii_tree, #to_cog, #to_relation, #type_check

Instance Method Details

#headingObject


14
15
16
# File 'lib/alf/algebra/operator/wrap.rb', line 14

def heading
  @heading ||= stay_heading.merge(as => Tuple[wrapped_heading])
end

#keysObject


18
19
20
21
22
23
# File 'lib/alf/algebra/operator/wrap.rb', line 18

def keys
  @keys ||= operand.keys.map{|k|
    rest = k.project(attributes, !allbut)
    (rest == k) ? rest : (rest | [ as ])
  }
end

#stay_attrsObject


37
38
39
# File 'lib/alf/algebra/operator/wrap.rb', line 37

def stay_attrs
  @stay_attrs ||= wrapped_heading.to_attr_list
end

#stay_headingObject


33
34
35
# File 'lib/alf/algebra/operator/wrap.rb', line 33

def stay_heading
  @stay_heading ||= operand.heading.project(attributes, !allbut)
end

#wrapped_attrsObject


29
30
31
# File 'lib/alf/algebra/operator/wrap.rb', line 29

def wrapped_attrs
  @wrapped_attrs ||= wrapped_heading.to_attr_list
end

#wrapped_headingObject


25
26
27
# File 'lib/alf/algebra/operator/wrap.rb', line 25

def wrapped_heading
  @wrapped_heading ||= operand.heading.project(attributes, allbut)
end