Class: Piglet::Relation::Cross
- Inherits:
-
Object
- Object
- Piglet::Relation::Cross
- Includes:
- Relation
- Defined in:
- lib/piglet/relation/cross.rb
Overview
:nodoc:
Instance Attribute Summary
Attributes included from Relation
Instance Method Summary collapse
-
#initialize(relations, interpreter, options = {}) ⇒ Cross
constructor
A new instance of Cross.
- #schema ⇒ Object
- #to_s ⇒ Object
Methods included from Relation
#[], #alias, #cogroup, #cross, #distinct, #eql?, #field, #filter, #foreach, #group, #hash, #join, #limit, #method_missing, #nested_foreach, #next_field_alias, #order, #sample, #split, #stream, #union
Constructor Details
#initialize(relations, interpreter, options = {}) ⇒ Cross
Returns a new instance of Cross.
8 9 10 11 |
# File 'lib/piglet/relation/cross.rb', line 8 def initialize(relations, interpreter, ={}) ||= {} @sources, @interpreter, @parallel = relations, interpreter, [:parallel] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Piglet::Relation::Relation
Instance Method Details
#schema ⇒ Object
13 14 15 16 |
# File 'lib/piglet/relation/cross.rb', line 13 def schema schemas = @sources.map { |s| s.schema } schemas.first.union(schemas[1..-1]) end |
#to_s ⇒ Object
18 19 20 21 22 |
# File 'lib/piglet/relation/cross.rb', line 18 def to_s str = "CROSS #{source_aliases.join(', ')}" str << " PARALLEL #{@parallel}" if @parallel str end |