Class: R2OAS::Dynamic::Schema::V3::HookableBaseObject
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
#components_object_class, #components_request_body_object_class, #components_schema_object_class, #external_document_object_class, #info_object_class, #path_item_object_class, #paths_object_class
Constructor Details
Returns a new instance of HookableBaseObject.
61
62
63
64
|
# File 'lib/r2-oas/dynamic/schema/v3/object/from_routes/hookable_base_object.rb', line 61
def initialize(opts = {})
super(opts)
self.doc = {}
end
|
Instance Attribute Details
Returns the value of attribute doc.
59
60
61
|
# File 'lib/r2-oas/dynamic/schema/v3/object/from_routes/hookable_base_object.rb', line 59
def doc
@doc
end
|
Class Method Details
.execute_hook(on, *data) ⇒ Object
50
51
52
|
# File 'lib/r2-oas/dynamic/schema/v3/object/from_routes/hookable_base_object.rb', line 50
def execute_hook(on, *data)
hook.execute_hook(on, *data, self)
end
|
.has_hook?(name) ⇒ Boolean
54
55
56
|
# File 'lib/r2-oas/dynamic/schema/v3/object/from_routes/hookable_base_object.rb', line 54
def has_hook?(name)
hook.has_hook?(name, self)
end
|
36
37
38
|
# File 'lib/r2-oas/dynamic/schema/v3/object/from_routes/hookable_base_object.rb', line 36
def self.hook
@@hook
end
|
.hook=(value) ⇒ Object
32
33
34
|
# File 'lib/r2-oas/dynamic/schema/v3/object/from_routes/hookable_base_object.rb', line 32
def self.hook=(value)
@@hook = value
end
|
28
29
30
|
# File 'lib/r2-oas/dynamic/schema/v3/object/from_routes/hookable_base_object.rb', line 28
def self.hooks
superclass.hook.repository[:dynamic][self].global_hooks_data
end
|
.inherited(base) ⇒ Object
23
24
25
26
|
# File 'lib/r2-oas/dynamic/schema/v3/object/from_routes/hookable_base_object.rb', line 23
def self.inherited(base)
base.extend ClassMethods
self.hook = Hooks::Hook.register(:dynamic, base)
end
|
.off(on, callback, once = false) ⇒ Object
46
47
48
|
# File 'lib/r2-oas/dynamic/schema/v3/object/from_routes/hookable_base_object.rb', line 46
def off(on, callback, once = false)
hook.off(on, callback, self, once)
end
|
.on(on, callback, once = false) ⇒ Object
41
42
43
|
# File 'lib/r2-oas/dynamic/schema/v3/object/from_routes/hookable_base_object.rb', line 41
def on(on, callback, once = false)
hook.on(on, callback, self, once)
end
|
Instance Method Details
MEMO: Please overwrite when passing arguments other than ‘doc`
67
68
69
70
71
72
|
# File 'lib/r2-oas/dynamic/schema/v3/object/from_routes/hookable_base_object.rb', line 67
def to_doc
execute_before_create
create_doc
execute_after_create
doc
end
|
#use_superclass_hook ⇒ Object
74
75
76
|
# File 'lib/r2-oas/dynamic/schema/v3/object/from_routes/hookable_base_object.rb', line 74
def use_superclass_hook
self.class.hook.repository[:dynamic][self.class] = self.class.hook.repository[:dynamic][self.class.superclass]
end
|