Module: Axiom::Algebra::Projection::Methods

Defined in:
lib/axiom/algebra/projection.rb

Instance Method Summary collapse

Instance Method Details

#project(attributes) ⇒ Projection

Return a relation with only the attributes specified

Examples:

projection = relation.project([:a, :b, :c])

Parameters:

  • attributes (#to_ary)

    the attributes to keep in the header

Returns:



169
170
171
# File 'lib/axiom/algebra/projection.rb', line 169

def project(attributes)
  Projection.new(self, attributes)
end

#remove(attributes) ⇒ Projection

Return a relation with attributes not specified

Examples:

projection = relation.remove([:a, b, c])

Parameters:

  • attributes (#to_ary)

    the attributes to remove from the header

Returns:



184
185
186
# File 'lib/axiom/algebra/projection.rb', line 184

def remove(attributes)
  project(header - attributes)
end