lib/r2-oas/plugin/hookable.rb in r2-oas-0.4.1 vs lib/r2-oas/plugin/hookable.rb in r2-oas-0.5.0

- old
+ new

@@ -3,23 +3,28 @@ require 'r2-oas/hooks/hook' module R2OAS module Plugin module Hookable + def self.extended(base) + super + base.class_variable_set(:@@hook_klass, ::R2OAS::Hooks::Hook.register(:plugin, base)) + end + def hooks_map hook_klass.repository[:plugin] end def hooks hooks_map[self].global_hooks_data end def hook_klass=(klass) - @@hook_klass = klass + class_variable_set(:@@hook_klass, klass) end def hook_klass - @@hook_klass + class_variable_get(:@@hook_klass) end def on(on, callback, once = false) hook_klass.on(on, callback, self, once) end