Class: Alf::Algebra::Clip

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

Instance Attribute Summary

Attributes included from Operator

#operands

Instance Method Summary collapse

Methods included from Unary

included, #operand, #with_operand

Methods included from NonRelational

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



13
14
15
# File 'lib/alf/algebra/operator/clip.rb', line 13

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

#key_preserving?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/alf/algebra/operator/clip.rb', line 23

def key_preserving?
  keys.any?{|k| operand.keys.include?(k) }
end

#keysObject



17
18
19
20
21
# File 'lib/alf/algebra/operator/clip.rb', line 17

def keys
  @keys ||= operand.keys.select{|k|
    k.project(attributes, allbut) == k
  }.if_empty{ Keys[ heading.to_attr_list ] }
end

#stay_attributesObject



27
28
29
# File 'lib/alf/algebra/operator/clip.rb', line 27

def stay_attributes
  allbut ? heading.to_attr_list : attributes
end