module SuperModule::V1::ModuleBodyMethodCallRecorder

Public Instance Methods

__all_module_body_method_calls_in_definition_order() click to toggle source
# File lib/super_module/v1/module_body_method_call_recorder.rb, line 34
def __all_module_body_method_calls_in_definition_order
  ancestor_module_body_method_calls = included_super_modules.map(&:__module_body_method_calls).flatten(1)
  all_module_body_method_calls = __module_body_method_calls + ancestor_module_body_method_calls
  all_module_body_method_calls.reverse
end
__inside_super_module_included=(value) click to toggle source
# File lib/super_module/v1/module_body_method_call_recorder.rb, line 30
def __inside_super_module_included=(value)
  @__inside_super_module_included = !!value
end
__inside_super_module_included?() click to toggle source
# File lib/super_module/v1/module_body_method_call_recorder.rb, line 26
def __inside_super_module_included?
  @__inside_super_module_included
end
__method_signature(method_name, args) click to toggle source
# File lib/super_module/v1/module_body_method_call_recorder.rb, line 17
def __method_signature(method_name, args)
  "#{method_name}(#{args.to_a.map(&:to_s).join(",")})"
end
__module_body_method_calls() click to toggle source
# File lib/super_module/v1/module_body_method_call_recorder.rb, line 13
def __module_body_method_calls
  @__module_body_method_calls ||= []
end
__record_method_call(method_name, *args, &block) click to toggle source
# File lib/super_module/v1/module_body_method_call_recorder.rb, line 21
def __record_method_call(method_name, *args, &block)
  return if self.is_a?(Class) || __inside_super_module_included?
  __module_body_method_calls << [method_name, args, block]
end
__singleton_method_call_recorder(method_name, method_args) click to toggle source
# File lib/super_module/v1/module_body_method_call_recorder.rb, line 40
def __singleton_method_call_recorder(method_name, method_args)
  unless __super_module_singleton_methods_excluded_from_call_recording.include?(method_name)
    method_call_recorder_args = "'#{method_name}'"
    method_call_recorder_args << ", #{method_args}" unless method_args.to_s.strip == ''
    method_call_recorder_args = method_call_recorder_args.split(",").each_with_index.map {|arg, i| i == 0 ? arg : arg.split("=").first}.join(",")
    "self.__record_method_call(#{method_call_recorder_args})"
  end
end
__super_module_singleton_methods_excluded_from_call_recording() click to toggle source
# File lib/super_module/v1/module_body_method_call_recorder.rb, line 4
def __super_module_singleton_methods_excluded_from_call_recording
  @__super_module_singleton_methods_excluded_from_call_recording ||= [
    :__record_method_call,
    :__method_signature,
    :__inside_super_module_included?,
    :__inside_super_module_included=,
  ]
end