Class: ActiveRecord::Refined::AST::In
- Defined in:
- lib/active_record/refined/ast.rb
Overview
IN for a list of values, BETWEEN for a range.
Instance Attribute Summary collapse
-
#operand ⇒ Object
readonly
Returns the value of attribute operand.
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Instance Method Summary collapse
-
#initialize(operand, values) ⇒ In
constructor
A new instance of In.
- #to_arel(table) ⇒ Object
Methods inherited from Predicate
Methods inherited from Node
Constructor Details
#initialize(operand, values) ⇒ In
Returns a new instance of In.
222 223 224 225 |
# File 'lib/active_record/refined/ast.rb', line 222 def initialize(operand, values) @operand = operand @values = values end |
Instance Attribute Details
#operand ⇒ Object (readonly)
Returns the value of attribute operand.
220 221 222 |
# File 'lib/active_record/refined/ast.rb', line 220 def operand @operand end |
#values ⇒ Object (readonly)
Returns the value of attribute values.
220 221 222 |
# File 'lib/active_record/refined/ast.rb', line 220 def values @values end |
Instance Method Details
#to_arel(table) ⇒ Object
227 228 229 230 231 232 233 |
# File 'lib/active_record/refined/ast.rb', line 227 def to_arel(table) arel_operand = to_arel_operand(operand, table) case values when Range then arel_operand.between(values) else arel_operand.in(values) end end |