Class: Arel::Ordering
- Inherits:
-
Struct
- Object
- Struct
- Arel::Ordering
- Defined in:
- lib/arel/algebra/ordering.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#attribute ⇒ Object
Returns the value of attribute attribute.
Instance Method Summary collapse
- #bind(relation) ⇒ Object
- #eval(row1, row2) ⇒ Object
- #to_ordering ⇒ Object
- #to_sql(formatter = Sql::OrderClause.new(relation)) ⇒ Object
Instance Attribute Details
#attribute ⇒ Object
Returns the value of attribute attribute
2 3 4 |
# File 'lib/arel/algebra/ordering.rb', line 2 def attribute @attribute end |
Instance Method Details
#bind(relation) ⇒ Object
5 6 7 |
# File 'lib/arel/algebra/ordering.rb', line 5 def bind(relation) self.class.new(attribute.bind(relation)) end |
#eval(row1, row2) ⇒ Object
13 14 15 |
# File 'lib/arel/algebra/ordering.rb', line 13 def eval(row1, row2) (attribute.eval(row1) <=> attribute.eval(row2)) * direction end |
#to_ordering ⇒ Object
9 10 11 |
# File 'lib/arel/algebra/ordering.rb', line 9 def to_ordering self end |
#to_sql(formatter = Sql::OrderClause.new(relation)) ⇒ Object
17 18 19 |
# File 'lib/arel/algebra/ordering.rb', line 17 def to_sql(formatter = Sql::OrderClause.new(relation)) formatter.ordering self end |