Module: CLI::Kit::Opts::Mixin::MixinClassMethods

Defined in:
lib/cli/kit/opts.rb

Instance Method Summary collapse

Instance Method Details

#include(included_module) ⇒ Object

: (Module included_module) -> void



13
14
15
16
17
18
# File 'lib/cli/kit/opts.rb', line 13

def include(included_module)
  super
  return unless included_module.is_a?(MixinClassMethods)

  included_module.tracked_methods.each { |m| track_method(m) }
end

#method_added(method_name) ⇒ Object

No signature - Sorbet uses method_added internally, so can't verify it



21
22
23
24
# File 'lib/cli/kit/opts.rb', line 21

def method_added(method_name) # rubocop:disable Sorbet/EnforceSignatures
  super
  track_method(method_name)
end

#track_method(method_name) ⇒ Object

: (Symbol method_name) -> void



27
28
29
30
# File 'lib/cli/kit/opts.rb', line 27

def track_method(method_name)
  @tracked_methods ||= []
  @tracked_methods << method_name unless @tracked_methods.include?(method_name)
end

#tracked_methodsObject

: -> Array



33
34
35
# File 'lib/cli/kit/opts.rb', line 33

def tracked_methods
  @tracked_methods || []
end