Class: ActiveRecord::Type::Registration
Do not use. This class is for internal use only.
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Subclasses:
|
|
Inherits: | Object |
Defined in: | activerecord/lib/active_record/type/adapter_specific_registry.rb |
Class Method Summary
Instance Attribute Summary
Instance Method Summary
- #<=>(other)
- #call(_registry, *args, adapter: nil, **kwargs)
- #matches?(type_name, *args, **kwargs) ⇒ Boolean
- #priority protected
- #priority_except_adapter protected
- #conflicts_with?(other) ⇒ Boolean private
- #has_adapter_conflict?(other) ⇒ Boolean private
- #matches_adapter?(adapter: nil) ⇒ Boolean private
- #same_priority_except_adapter?(other) ⇒ Boolean private
Constructor Details
.new(name, block, adapter: nil, override: nil) ⇒ Registration
Instance Attribute Details
#adapter (readonly, protected)
[ GitHub ]#block (readonly, protected)
[ GitHub ]#name (readonly, protected)
[ GitHub ]#override (readonly, protected)
[ GitHub ]Instance Method Details
#<=>(other)
[ GitHub ]# File 'activerecord/lib/active_record/type/adapter_specific_registry.rb', line 63
def <=>(other) if conflicts_with?(other) raise TypeConflictError.new("Type #{name} was registered for all adapters, but shadows a native type with the same name for #{other.adapter}".squish) end priority <=> other.priority end
#call(_registry, *args, adapter: nil, **kwargs)
[ GitHub ]# File 'activerecord/lib/active_record/type/adapter_specific_registry.rb', line 55
def call(_registry, *args, adapter: nil, **kwargs) block.call(*args, **kwargs) end
#conflicts_with?(other) ⇒ Boolean (private)
# File 'activerecord/lib/active_record/type/adapter_specific_registry.rb', line 95
def conflicts_with?(other) same_priority_except_adapter?(other) && has_adapter_conflict?(other) end
#has_adapter_conflict?(other) ⇒ Boolean (private)
#matches?(type_name, *args, **kwargs) ⇒ Boolean
# File 'activerecord/lib/active_record/type/adapter_specific_registry.rb', line 59
def matches?(type_name, *args, **kwargs) type_name == name && matches_adapter?(**kwargs) end
#matches_adapter?(adapter: nil) ⇒ Boolean (private)
#priority (protected)
[ GitHub ]#priority_except_adapter (protected)
[ GitHub ]# File 'activerecord/lib/active_record/type/adapter_specific_registry.rb', line 86
def priority_except_adapter priority & 0b111111100 end
#same_priority_except_adapter?(other) ⇒ Boolean (private)
# File 'activerecord/lib/active_record/type/adapter_specific_registry.rb', line 100
def same_priority_except_adapter?(other) priority_except_adapter == other.priority_except_adapter end