Class: ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Uuid

Inherits:
Type::Value show all
Defined in:
activerecord/lib/active_record/connection_adapters/postgresql/oid/uuid.rb

Overview

:nodoc:

Constant Summary collapse

ACCEPTABLE_UUID =
%r{\A\{?([a-fA-F0-9]{4}-?){8}\}?\z}x

Instance Attribute Summary

Attributes inherited from Type::Value

#limit, #precision, #scale

Instance Method Summary collapse

Methods inherited from Type::Value

#==, #binary?, #changed?, #changed_in_place?, #hash, #initialize, #klass, #number?, #text?, #type_cast_for_schema, #type_cast_from_database, #type_cast_from_user

Constructor Details

This class inherits a constructor from ActiveRecord::Type::Value

Instance Method Details

#typeObject


10
11
12
# File 'activerecord/lib/active_record/connection_adapters/postgresql/oid/uuid.rb', line 10

def type
  :uuid
end

#type_cast(value) ⇒ Object


14
15
16
# File 'activerecord/lib/active_record/connection_adapters/postgresql/oid/uuid.rb', line 14

def type_cast(value)
  value.to_s[ACCEPTABLE_UUID, 0]
end