Module: R2OAS::Plugin::Hookable

Included in:
Base, Executor, V3::Visitable
Defined in:
lib/r2-oas/plugin/hookable.rb

Instance Method Summary collapse

Instance Method Details

#execute_hook(on, *data) ⇒ Object



33
34
35
# File 'lib/r2-oas/plugin/hookable.rb', line 33

def execute_hook(on, *data)
  hook_klass.execute_hook(on, *data, self)
end

#has_hook?(name) ⇒ Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/r2-oas/plugin/hookable.rb', line 37

def has_hook?(name)
  hook_klass.has_hook?(name, self)
end

#hook_klassObject



20
21
22
# File 'lib/r2-oas/plugin/hookable.rb', line 20

def hook_klass
  @@hook_klass
end

#hook_klass=(klass) ⇒ Object



16
17
18
# File 'lib/r2-oas/plugin/hookable.rb', line 16

def hook_klass=(klass)
  @@hook_klass = klass
end

#hooksObject



12
13
14
# File 'lib/r2-oas/plugin/hookable.rb', line 12

def hooks
  hooks_map[self].global_hooks_data
end

#hooks_mapObject



8
9
10
# File 'lib/r2-oas/plugin/hookable.rb', line 8

def hooks_map
  hook_klass.repository[:plugin]
end

#off(on, callback, once = false) ⇒ Object

MEMO: Do not Use



29
30
31
# File 'lib/r2-oas/plugin/hookable.rb', line 29

def off(on, callback, once = false)
  hook_klass.off(on, callback, self, once)
end

#on(on, callback, once = false) ⇒ Object



24
25
26
# File 'lib/r2-oas/plugin/hookable.rb', line 24

def on(on, callback, once = false)
  hook_klass.on(on, callback, self, once)
end