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
decode_registered, #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
21 22 23 |
# File 'lib/alf-algebra/alf/algebra/operator/project.rb', line 21 def key_preserving? keys.any?{|k| operand.keys.include?(k) } end |
#keys ⇒ Object
15 16 17 18 19 |
# File 'lib/alf-algebra/alf/algebra/operator/project.rb', line 15 def keys @keys ||= operand.keys.select{|k| k.project(attributes, allbut) == k }.if_empty{ Keys[ heading.to_attr_list ] } end |
#stay_attributes ⇒ Object
25 26 27 |
# File 'lib/alf-algebra/alf/algebra/operator/project.rb', line 25 def stay_attributes allbut ? heading.to_attr_list : attributes end |