class Minitag::ExtensionRegistry
Stores and extends classes that relies on tags with the Minitag::TagExtension
module.
Public Class Methods
new()
click to toggle source
# File lib/minitag/extension_registry.rb, line 7 def initialize @registry = {} end
Public Instance Methods
register(klass)
click to toggle source
Extends a class with Minitag::TagExtension
and stores it as extended.
Invariants:
- Classes that were already extended will be ignored during this operation.
@param [Class] klass a class that will be extended.
@return [void]
# File lib/minitag/extension_registry.rb, line 19 def register(klass) return if @registry.key?(klass) @registry[klass] = true klass.singleton_class.prepend(Minitag::TagExtension) end