blob: dd97393eac7bbc5b744f05ec30da11381a400ae9 (
plain) (
tree)
|
|
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
|