Class: ActiveRecord::PredicateBuilder::ComparisonAttribute
Do not use. This class is for internal use only.
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
|
|
|
Instance Chain:
|
|
| Inherits: |
Arel::Attributes::Attribute
|
| Defined in: | activerecord/lib/active_record/relation/predicate_builder/comparison.rb |
Class Method Summary
Instance Attribute Summary
- #attribute readonly
- #expression readonly
- #type_cast_for_database readonly
- #type_caster readonly
::Arel::Attributes::Attribute - Inherited
Instance Method Summary
- #==(other) (also: #eql?)
- #able_to_type_cast? ⇒ Boolean
- #comparison_expression(expression)
-
#eql?(other)
Alias for #==.
- #fetch_attribute
- #hash
::Arel::Attributes::Attribute - Inherited
| #fetch_attribute, | |
| #lower | Create a node for lowering this attribute. |
| #type_cast_for_database, #type_caster | |
::Arel::Math - Included
::Arel::OrderPredications - Included
::Arel::AliasPredication - Included
::Arel::Predications - Included
::Arel::Expressions - Included
::Struct - Inherited
Constructor Details
.new(attribute, type_caster) ⇒ ComparisonAttribute
# File 'activerecord/lib/active_record/relation/predicate_builder/comparison.rb', line 11
def initialize(attribute, type_caster) super(attribute.relation, attribute.name) @attribute = attribute @type_caster = type_caster @expression = comparison_expression(attribute) end
Instance Attribute Details
#attribute (readonly)
[ GitHub ]# File 'activerecord/lib/active_record/relation/predicate_builder/comparison.rb', line 9
attr_reader :attribute, :expression, :type_caster
#expression (readonly)
[ GitHub ]# File 'activerecord/lib/active_record/relation/predicate_builder/comparison.rb', line 9
attr_reader :attribute, :expression, :type_caster
#type_cast_for_database (readonly)
[ GitHub ]# File 'activerecord/lib/active_record/relation/predicate_builder/comparison.rb', line 22
delegate :able_to_type_cast?, :type_cast_for_database, to: :attribute
#type_caster (readonly)
[ GitHub ]# File 'activerecord/lib/active_record/relation/predicate_builder/comparison.rb', line 9
attr_reader :attribute, :expression, :type_caster
Instance Method Details
#==(other) Also known as: #eql?
[ GitHub ]# File 'activerecord/lib/active_record/relation/predicate_builder/comparison.rb', line 32
def ==(other) self.class == other.class && attribute == other.attribute && expression == other.expression end
#able_to_type_cast? ⇒ Boolean
# File 'activerecord/lib/active_record/relation/predicate_builder/comparison.rb', line 22
delegate :able_to_type_cast?, :type_cast_for_database, to: :attribute
#comparison_expression(expression)
[ GitHub ]# File 'activerecord/lib/active_record/relation/predicate_builder/comparison.rb', line 18
def comparison_expression(expression) type_caster.comparison_expression(expression) end
#eql?(other)
Alias for #==.
# File 'activerecord/lib/active_record/relation/predicate_builder/comparison.rb', line 37
alias eql? ==
#fetch_attribute
[ GitHub ]# File 'activerecord/lib/active_record/relation/predicate_builder/comparison.rb', line 24
def fetch_attribute(&) attribute.fetch_attribute(&) end
#hash
[ GitHub ]# File 'activerecord/lib/active_record/relation/predicate_builder/comparison.rb', line 28
def hash [self.class, attribute, expression].hash end