123456789_123456789_123456789_123456789_123456789_

Class: Arel::Nodes::HomogeneousIn

Do not use. This class is for internal use only.
Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Node
Instance Chain:
Inherits: Arel::Nodes::Node
Defined in: activerecord/lib/arel/nodes/homogeneous_in.rb

Class Method Summary

Instance Attribute Summary

Node - Inherited

Instance Method Summary

Node - Inherited

#and

Factory method to create an And node.

#fetch_attribute, #invert,
#not

Factory method to create a Nodes::Not node that has the recipient of the caller as a child.

#or

Factory method to create a Grouping node that has an Or node as a child.

#to_sql

FIXME: this method should go away.

::Arel::FactoryMethods - Included

Constructor Details

.new(values, attribute, type) ⇒ HomogeneousIn

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/homogeneous_in.rb', line 8

def initialize(values, attribute, type)
  @values = values
  @attribute = attribute
  @type = type
end

Instance Attribute Details

#attribute (readonly)

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/homogeneous_in.rb', line 6

attr_reader :attribute, :values, :type

#equality?Boolean (readonly)

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/homogeneous_in.rb', line 23

def equality?
  type == :in
end

#type (readonly)

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/homogeneous_in.rb', line 6

attr_reader :attribute, :values, :type

#values (readonly)

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/homogeneous_in.rb', line 6

attr_reader :attribute, :values, :type

Instance Method Details

#==(other)

Alias for #eql?.

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/homogeneous_in.rb', line 21

alias :== :eql?

#casted_values

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/homogeneous_in.rb', line 39

def casted_values
  type = attribute.type_caster

  casted_values = values.map do |raw_value|
    type.serialize(raw_value) if type.serializable?(raw_value)
  end

  casted_values.compact!
  casted_values
end

#eql?(other) ⇒ Boolean Also known as: #==

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/homogeneous_in.rb', line 18

def eql?(other)
  super || (self.class == other.class && self.ivars == other.ivars)
end

#fetch_attribute(&block)

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/homogeneous_in.rb', line 54

def fetch_attribute(&block)
  if attribute
    yield attribute
  else
    expr.fetch_attribute(&block)
  end
end

#hash

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/homogeneous_in.rb', line 14

def hash
  ivars.hash
end

#invert

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/homogeneous_in.rb', line 27

def invert
  Arel::Nodes::HomogeneousIn.new(values, attribute, type == :in ? :notin : :in)
end

#ivars (protected)

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/homogeneous_in.rb', line 63

def ivars
  [@attribute, @values, @type]
end

#left

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/homogeneous_in.rb', line 31

def left
  attribute
end

#proc_for_binds

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/homogeneous_in.rb', line 50

def proc_for_binds
  #=> value { ActiveModel::Attribute.with_cast_value(attribute.name, value, ActiveModel::Type.default_value) }
end

#right

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/homogeneous_in.rb', line 35

def right
  attribute.quoted_array(values)
end