Sha256: a0c615ed28a315fe0eaf895cfcbd75c823b726a48dfe51f8010d096370a93d48

Contents?: true

Size: 929 Bytes

Versions: 66

Compression:

Stored size: 929 Bytes

Contents

# frozen_string_literal: true

module ActiveRecord
  module ConnectionAdapters
    module CipherStashPG
      module OID # :nodoc:
        class Uuid < Type::Value # :nodoc:
          ACCEPTABLE_UUID = %r{\A(\{)?([a-fA-F0-9]{4}-?){8}(?(1)\}|)\z}

          alias :serialize :deserialize

          def type
            :uuid
          end

          def changed?(old_value, new_value, _new_value_before_type_cast)
            old_value.class != new_value.class ||
              new_value && old_value.casecmp(new_value) != 0
          end

          def changed_in_place?(raw_old_value, new_value)
            raw_old_value.class != new_value.class ||
              new_value && raw_old_value.casecmp(new_value) != 0
          end

          private
            def cast_value(value)
              casted = value.to_s
              casted if casted.match?(ACCEPTABLE_UUID)
            end
        end
      end
    end
  end
end

Version data entries

66 entries across 32 versions & 1 rubygems

Version Path
activerecord-cipherstash-pg-adapter-0.8.5 lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/uuid.rb
activerecord-cipherstash-pg-adapter-0.8.5 lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/uuid.rb
activerecord-cipherstash-pg-adapter-0.8.5 lib/active_record/connection_adapters/7.1/cipherstash_pg/oid/uuid.rb
activerecord-cipherstash-pg-adapter-0.8.4 lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/uuid.rb
activerecord-cipherstash-pg-adapter-0.8.4 lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/uuid.rb
activerecord-cipherstash-pg-adapter-0.8.4 lib/active_record/connection_adapters/7.1/cipherstash_pg/oid/uuid.rb
activerecord-cipherstash-pg-adapter-0.8.3 lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/uuid.rb
activerecord-cipherstash-pg-adapter-0.8.3 lib/active_record/connection_adapters/7.1/cipherstash_pg/oid/uuid.rb
activerecord-cipherstash-pg-adapter-0.8.3 lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/uuid.rb
activerecord-cipherstash-pg-adapter-0.8.2 lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/uuid.rb
activerecord-cipherstash-pg-adapter-0.8.2 lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/uuid.rb
activerecord-cipherstash-pg-adapter-0.8.2 lib/active_record/connection_adapters/7.1/cipherstash_pg/oid/uuid.rb
activerecord-cipherstash-pg-adapter-0.8.1 lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/uuid.rb
activerecord-cipherstash-pg-adapter-0.8.1 lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/uuid.rb
activerecord-cipherstash-pg-adapter-0.8.0 lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/uuid.rb
activerecord-cipherstash-pg-adapter-0.8.0 lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/uuid.rb
activerecord-cipherstash-pg-adapter-0.7.19 lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/uuid.rb
activerecord-cipherstash-pg-adapter-0.7.19 lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/uuid.rb
activerecord-cipherstash-pg-adapter-0.7.18 lib/active_record/connection_adapters/7.0/cipherstash_pg/oid/uuid.rb
activerecord-cipherstash-pg-adapter-0.7.18 lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/uuid.rb