Class: ActiveRecord::Type::DecorationRegistration

Inherits:
Registration show all
Defined in:
activerecord/lib/active_record/type/adapter_specific_registry.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from Registration

#<=>

Constructor Details

#initialize(options, klass, adapter: nil) ⇒ DecorationRegistration

Returns a new instance of DecorationRegistration.



111
112
113
114
115
# File 'activerecord/lib/active_record/type/adapter_specific_registry.rb', line 111

def initialize(options, klass, adapter: nil)
  @options = options
  @klass = klass
  @adapter = adapter
end

Instance Method Details

#call(registry, *args, **kwargs) ⇒ Object



117
118
119
120
# File 'activerecord/lib/active_record/type/adapter_specific_registry.rb', line 117

def call(registry, *args, **kwargs)
  subtype = registry.lookup(*args, **kwargs.except(*options.keys))
  klass.new(subtype)
end

#matches?(*args, **kwargs) ⇒ Boolean

Returns:



122
123
124
# File 'activerecord/lib/active_record/type/adapter_specific_registry.rb', line 122

def matches?(*args, **kwargs)
  matches_adapter?(**kwargs) && matches_options?(**kwargs)
end

#priorityObject



126
127
128
# File 'activerecord/lib/active_record/type/adapter_specific_registry.rb', line 126

def priority
  super | 4
end