activerecord7-redshift-adapter-pennylane 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,36 +4,40 @@ module ActiveRecord
4
4
  module ConnectionAdapters
5
5
  module Redshift
6
6
  class TypeMetadata < DelegateClass(SqlTypeMetadata)
7
- attr_reader :oid, :fmod, :array
7
+ undef to_yaml if method_defined?(:to_yaml)
8
+
9
+ include Deduplicable
10
+
11
+ attr_reader :oid, :fmod
8
12
 
9
13
  def initialize(type_metadata, oid: nil, fmod: nil)
10
14
  super(type_metadata)
11
- @type_metadata = type_metadata
12
15
  @oid = oid
13
16
  @fmod = fmod
14
- @array = /\[\]$/ === type_metadata.sql_type
15
- end
16
-
17
- def sql_type
18
- super.gsub(/\[\]$/, '')
19
17
  end
20
18
 
21
19
  def ==(other)
22
- other.is_a?(Redshift::TypeMetadata) &&
23
- attributes_for_hash == other.attributes_for_hash
20
+ other.is_a?(TypeMetadata) &&
21
+ __getobj__ == other.__getobj__ &&
22
+ oid == other.oid &&
23
+ fmod == other.fmod
24
24
  end
25
25
  alias eql? ==
26
26
 
27
27
  def hash
28
- attributes_for_hash.hash
28
+ TypeMetadata.hash ^
29
+ __getobj__.hash ^
30
+ oid.hash ^
31
+ fmod.hash
29
32
  end
30
33
 
31
- protected
32
-
33
- def attributes_for_hash
34
- [self.class, @type_metadata, oid, fmod]
34
+ private
35
+ def deduplicated
36
+ __setobj__(__getobj__.deduplicate)
37
+ super
35
38
  end
36
39
  end
37
40
  end
41
+ RedshiftTypeMetadata = Redshift::TypeMetadata
38
42
  end
39
43
  end