Module: TypeToolkit::MethodDefRecorder
- Defined in:
- lib/type_toolkit/method_def_recorder.rb
Overview
This module tracks new methods being defined, and whether they were
instance methods (def foo; end) or singleton methods (def self.foo; end).
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#__last_method_def ⇒ Object
readonly
: [Symbol, bool]?.
Class Method Summary collapse
-
.extended(target_module) ⇒ Object
: (Module) -> void.
Instance Method Summary collapse
-
#method_added(m) ⇒ Object
Need
@without_runtimebecause of https://github.com/Shopify/tapioca/issues/2513 : (Symbol) -> void. -
#singleton_method_added(m) ⇒ Object
Need
@without_runtimebecause of https://github.com/Shopify/tapioca/issues/2513 : (Symbol) -> void.
Instance Attribute Details
#__last_method_def ⇒ Object (readonly)
: [Symbol, bool]?
9 10 11 |
# File 'lib/type_toolkit/method_def_recorder.rb', line 9 def __last_method_def @__last_method_def end |
Class Method Details
.extended(target_module) ⇒ Object
: (Module) -> void
13 14 15 16 |
# File 'lib/type_toolkit/method_def_recorder.rb', line 13 def extended(target_module) # Also extend the singleton class so methods are available there target_module.singleton_class.extend(ClassMethods) end |
Instance Method Details
#method_added(m) ⇒ Object
Need @without_runtime because of https://github.com/Shopify/tapioca/issues/2513
: (Symbol) -> void
33 34 35 36 37 38 |
# File 'lib/type_toolkit/method_def_recorder.rb', line 33 def method_added(m) is_singleton_method = false @__last_method_def = [m, is_singleton_method] #: [Symbol, bool]? super end |
#singleton_method_added(m) ⇒ Object
Need @without_runtime because of https://github.com/Shopify/tapioca/issues/2513
: (Symbol) -> void
44 45 46 47 48 49 50 51 |
# File 'lib/type_toolkit/method_def_recorder.rb', line 44 def singleton_method_added(m) return super if m == :singleton_method_added is_singleton_method = true @__last_method_def = [m, is_singleton_method] #: [Symbol, bool]? super end |