Class: Piglet::Relation::Order
- Inherits:
-
Object
- Object
- Piglet::Relation::Order
- Includes:
- Relation
- Defined in:
- lib/piglet/relation/order.rb
Overview
:nodoc:
Instance Attribute Summary
Attributes included from Relation
Instance Method Summary collapse
-
#initialize(relation, interpreter, fields, options) ⇒ Order
constructor
A new instance of Order.
- #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, #schema, #split, #stream, #union
Constructor Details
#initialize(relation, interpreter, fields, options) ⇒ Order
Returns a new instance of Order.
8 9 10 11 12 13 |
# File 'lib/piglet/relation/order.rb', line 8 def initialize(relation, interpreter, fields, ) ||= {} @interpreter = interpreter @sources, @parallel = [relation], [:parallel] @fields = fields.is_a?(Enumerable) ? fields : [fields] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Piglet::Relation::Relation
Instance Method Details
#to_s ⇒ Object
15 16 17 18 |
# File 'lib/piglet/relation/order.rb', line 15 def to_s target = @sources.first.respond_to?(:field_alias) ? @sources.first.field_alias : @sources.first.alias "ORDER #{target} BY #{field_strings}" end |