Sha256: 58a10e623dbbb2807d00fca603fba417da63b27f627f15a8d46cc16a50c160c6

Contents?: true

Size: 701 Bytes

Versions: 1

Compression:

Stored size: 701 Bytes

Contents

module ActiveRecord
  module ConnectionAdapters
    module PostgreSQL
      module OID # :nodoc:
        class Uuid < Type::Value # :nodoc:
          RFC_4122 = %r{\A\{?[a-fA-F0-9]{4}-?
                             [a-fA-F0-9]{4}-?
                             [a-fA-F0-9]{4}-?
                             [1-5][a-fA-F0-9]{3}-?
                             [8-Bab][a-fA-F0-9]{3}-?
                             [a-fA-F0-9]{4}-?
                             [a-fA-F0-9]{4}-?
                             [a-fA-F0-9]{4}-?\}?\z}x

          def type
            :uuid
          end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activerecord-4.2.0.beta1 lib/active_record/connection_adapters/postgresql/oid/uuid.rb