blob: a7232fa24909383e9093d49d981cffd5e6c2b68e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# frozen_string_literal: true
module ActiveRecord
module ConnectionAdapters
module MySQL
class TypeMetadata < DelegateClass(SqlTypeMetadata) # :nodoc:
undef to_yaml if method_defined?(:to_yaml)
include Deduplicable
attr_reader :extra
def initialize(type_metadata, extra: nil)
super(type_metadata)
@extra = extra
end
def ==(other)
other.is_a?(TypeMetadata) &&
__getobj__ == other.__getobj__ &&
extra == other.extra
end
alias eql? ==
def hash
TypeMetadata.hash ^
__getobj__.hash ^
extra.hash
end
private
def deduplicated
__setobj__(__getobj__.deduplicate)
@extra = -extra if extra
super
end
end
end
end
end
|