Class: R2OAS::Plugin::Base

Inherits:
Base show all
Extended by:
Hookable
Defined in:
lib/r2-oas/plugin/base.rb

Direct Known Subclasses

V3::Transform

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from Hookable

execute_hook, has_hook?, hook_klass, hook_klass=, hooks, hooks_map, off, on

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from R2OAS::Base

Class Attribute Details

.optsObject

Returns the value of attribute opts.



13
14
15
# File 'lib/r2-oas/plugin/base.rb', line 13

def opts
  @opts
end

.plugin_nameObject

Returns the value of attribute plugin_name.



13
14
15
# File 'lib/r2-oas/plugin/base.rb', line 13

def plugin_name
  @plugin_name
end

.typeObject

Returns the value of attribute type.



13
14
15
# File 'lib/r2-oas/plugin/base.rb', line 13

def type
  @type
end

Class Method Details

.execute_setup(*args) ⇒ Object



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

def execute_setup(*args)
  execute_hook(:setup, *args)
end

.execute_teardown(*args) ⇒ Object



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

def execute_teardown(*args)
  execute_hook(:teardown, *args)
end

.inherited(base) ⇒ Object



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

def inherited(base)
  super
  base.opts = {}
end

.setup(&block) ⇒ Object



15
16
17
18
19
20
# File 'lib/r2-oas/plugin/base.rb', line 15

def setup(&block)
  return unless block_given?

  callback = proc { |*args| block.call(*args) }
  on(:setup, callback)
end

.teardown(&block) ⇒ Object



22
23
24
25
26
27
# File 'lib/r2-oas/plugin/base.rb', line 22

def teardown(&block)
  return unless block_given?

  callback = proc { |*args| block.call(*args) }
  on(:teardown, callback)
end