Class: Torque::PostgreSQL::Arel::Nodes::Column

Inherits:
Arel::Nodes::Binary
  • Object
show all
Includes:
Arel::AliasPredication, Arel::Expressions, Arel::Math, Arel::OrderPredications, Arel::Predications
Defined in:
lib/torque/postgresql/arel/nodes.rb

Overview

Accessing a single column of a composite value, which behaves like an attribute of the composite type it belongs to

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, name, type_caster) ⇒ Column

Returns a new instance of Column.



34
35
36
37
# File 'lib/torque/postgresql/arel/nodes.rb', line 34

def initialize(source, name, type_caster)
  @type_caster = type_caster
  super(source, name.to_s)
end

Instance Attribute Details

#type_casterObject (readonly)

Returns the value of attribute type_caster.



31
32
33
# File 'lib/torque/postgresql/arel/nodes.rb', line 31

def type_caster
  @type_caster
end

Instance Method Details

#able_to_type_cast?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/torque/postgresql/arel/nodes.rb', line 39

def able_to_type_cast?
  true
end

#type_cast_for_database(value) ⇒ Object



43
44
45
# File 'lib/torque/postgresql/arel/nodes.rb', line 43

def type_cast_for_database(value)
  type_caster.serialize(value)
end