Class: ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Array
- Inherits:
-
Type::Value
- Object
- Type::Value
- ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Array
- Includes:
- Type::Mutable
- Defined in:
- lib/active_record/connection_adapters/postgresql/oid/array.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#delimiter ⇒ Object
readonly
Returns the value of attribute delimiter.
-
#subtype ⇒ Object
readonly
Returns the value of attribute subtype.
Attributes inherited from Type::Value
Instance Method Summary collapse
-
#initialize(subtype, delimiter = ',') ⇒ Array
constructor
A new instance of Array.
- #type_cast_for_database(value) ⇒ Object
- #type_cast_from_database(value) ⇒ Object
- #type_cast_from_user(value) ⇒ Object
Methods included from Type::Mutable
Methods inherited from Type::Value
#==, #binary?, #changed?, #changed_in_place?, #klass, #number?, #text?, #type, #type_cast_for_schema
Constructor Details
#initialize(subtype, delimiter = ',') ⇒ Array
Returns a new instance of Array.
23 24 25 26 |
# File 'lib/active_record/connection_adapters/postgresql/oid/array.rb', line 23 def initialize(subtype, delimiter = ',') @subtype = subtype @delimiter = delimiter end |
Instance Attribute Details
#delimiter ⇒ Object (readonly)
Returns the value of attribute delimiter.
20 21 22 |
# File 'lib/active_record/connection_adapters/postgresql/oid/array.rb', line 20 def delimiter @delimiter end |
#subtype ⇒ Object (readonly)
Returns the value of attribute subtype.
20 21 22 |
# File 'lib/active_record/connection_adapters/postgresql/oid/array.rb', line 20 def subtype @subtype end |
Instance Method Details
#type_cast_for_database(value) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/active_record/connection_adapters/postgresql/oid/array.rb', line 43 def type_cast_for_database(value) if value.is_a?(::Array) cast_value_for_database(value) else super end end |
#type_cast_from_database(value) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/active_record/connection_adapters/postgresql/oid/array.rb', line 28 def type_cast_from_database(value) if value.is_a?(::String) type_cast_array(parse_pg_array(value), :type_cast_from_database) else super end end |
#type_cast_from_user(value) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/active_record/connection_adapters/postgresql/oid/array.rb', line 36 def type_cast_from_user(value) if value.is_a?(::String) value = parse_pg_array(value) end type_cast_array(value, :type_cast_from_user) end |