Class: Alf::Algebra::Project
- Inherits:
-
Object
- Object
- Alf::Algebra::Project
- Includes:
- Operator, Relational, Unary
- Defined in:
- lib/alf-algebra/alf/algebra/operator/project.rb
Instance Attribute Summary
Attributes included from Operator
Attributes included from Support::Bindable
Instance Method Summary collapse
Methods included from Operator
#==, #bind, #dup, included, #initialize, #signature, #to_lispy, #to_relvar, #with_operands
Methods included from Support::Registry
#each, #listen, #listeners, #register, #registered
Methods included from Operand
#attr_list, coerce, #to_cog, #to_dot, #to_relation
Methods included from Support::Bindable
Methods included from Relational
Methods included from Unary
included, #operand, #with_operand
Instance Method Details
#heading ⇒ Object
11 12 13 |
# File 'lib/alf-algebra/alf/algebra/operator/project.rb', line 11 def heading @heading ||= operand.heading.project(attributes, allbut) end |
#key_preserving? ⇒ Boolean
26 27 28 |
# File 'lib/alf-algebra/alf/algebra/operator/project.rb', line 26 def key_preserving? keys.any?{|k| operand.keys.any?{|op_k| k.subset?(op_k) } } end |
#keys ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/alf-algebra/alf/algebra/operator/project.rb', line 15 def keys @keys ||= begin keys = operand.keys.project(attributes, allbut).compact if keys.empty? has_empty = operand.keys.include?(AttrList::EMPTY) keys = Keys[ has_empty ? AttrList::EMPTY : heading.to_attr_list ] end keys end end |
#stay_attributes ⇒ Object
30 31 32 |
# File 'lib/alf-algebra/alf/algebra/operator/project.rb', line 30 def stay_attributes allbut ? heading.to_attr_list : attributes end |