Class: ActiveEntity::Type::Registration
- Inherits:
-
Object
- Object
- ActiveEntity::Type::Registration
- Defined in:
- lib/active_entity/type/registry.rb
Overview
:nodoc:
Direct Known Subclasses
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #call(_registry, *args, **kwargs) ⇒ Object
-
#initialize(name, block, override: nil) ⇒ Registration
constructor
A new instance of Registration.
- #matches?(type_name, *args, **kwargs) ⇒ Boolean
Constructor Details
#initialize(name, block, override: nil) ⇒ Registration
Returns a new instance of Registration.
49 50 51 52 53 |
# File 'lib/active_entity/type/registry.rb', line 49 def initialize(name, block, override: nil) @name = name @block = block @override = override end |
Instance Method Details
#<=>(other) ⇒ Object
67 68 69 |
# File 'lib/active_entity/type/registry.rb', line 67 def <=>(other) priority <=> other.priority end |
#call(_registry, *args, **kwargs) ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/active_entity/type/registry.rb', line 55 def call(_registry, *args, **kwargs) if kwargs.any? # https://bugs.ruby-lang.org/issues/10856 block.call(*args, **kwargs) else block.call(*args) end end |
#matches?(type_name, *args, **kwargs) ⇒ Boolean
63 64 65 |
# File 'lib/active_entity/type/registry.rb', line 63 def matches?(type_name, *args, **kwargs) type_name == name end |