Class: ActiveRecord::Type::DecorationRegistration
- Inherits:
-
Registration
- Object
- Registration
- ActiveRecord::Type::DecorationRegistration
- Defined in:
- activerecord/lib/active_record/type/adapter_specific_registry.rb
Instance Method Summary collapse
- #call(registry, *args, **kwargs) ⇒ Object
-
#initialize(options, klass, adapter: nil) ⇒ DecorationRegistration
constructor
A new instance of DecorationRegistration.
- #matches?(*args, **kwargs) ⇒ Boolean
- #priority ⇒ Object
Methods inherited from Registration
Constructor Details
#initialize(options, klass, adapter: nil) ⇒ DecorationRegistration
Returns a new instance of DecorationRegistration.
93 94 95 96 97 |
# File 'activerecord/lib/active_record/type/adapter_specific_registry.rb', line 93 def initialize(, klass, adapter: nil) @options = @klass = klass @adapter = adapter end |
Instance Method Details
#call(registry, *args, **kwargs) ⇒ Object
99 100 101 102 |
# File 'activerecord/lib/active_record/type/adapter_specific_registry.rb', line 99 def call(registry, *args, **kwargs) subtype = registry.lookup(*args, **kwargs.except(*.keys)) klass.new(subtype) end |
#matches?(*args, **kwargs) ⇒ Boolean
104 105 106 |
# File 'activerecord/lib/active_record/type/adapter_specific_registry.rb', line 104 def matches?(*args, **kwargs) matches_adapter?(**kwargs) && (**kwargs) end |
#priority ⇒ Object
108 109 110 |
# File 'activerecord/lib/active_record/type/adapter_specific_registry.rb', line 108 def priority super | 4 end |