Class: ActiveRecord::Refined::AST::Ordering
- Defined in:
- lib/active_record/refined/ast.rb
Instance Attribute Summary collapse
-
#direction ⇒ Object
readonly
Returns the value of attribute direction.
-
#operand ⇒ Object
readonly
Returns the value of attribute operand.
Instance Method Summary collapse
-
#initialize(operand, direction) ⇒ Ordering
constructor
A new instance of Ordering.
- #to_arel(table) ⇒ Object
Methods inherited from Node
Constructor Details
#initialize(operand, direction) ⇒ Ordering
Returns a new instance of Ordering.
103 104 105 106 |
# File 'lib/active_record/refined/ast.rb', line 103 def initialize(operand, direction) @operand = operand @direction = direction end |
Instance Attribute Details
#direction ⇒ Object (readonly)
Returns the value of attribute direction.
101 102 103 |
# File 'lib/active_record/refined/ast.rb', line 101 def direction @direction end |
#operand ⇒ Object (readonly)
Returns the value of attribute operand.
101 102 103 |
# File 'lib/active_record/refined/ast.rb', line 101 def operand @operand end |
Instance Method Details
#to_arel(table) ⇒ Object
108 109 110 111 112 113 114 115 |
# File 'lib/active_record/refined/ast.rb', line 108 def to_arel(table) arel_operand = case operand when Node then operand.to_arel(table) when Symbol then table[operand] else operand end arel_operand.public_send(direction) end |