class RSpec::Matchers::DifferentiateBlockMethodTypes
@api private
methods (using ‘def self.foo`).
it defines as instance methods (using `def foo`) vs singleton
Evaluates a block in order to determine what methods, if any,
def capture_added_methods(object, method_list)
def capture_added_methods(object, method_list) object.__send__(:define_method, :singleton_method_added) do |method_name| method_list << method_name end method_list.delete(:singleton_method_added) end
def ignore_macro_methods
def ignore_macro_methods def singleton_class.method_missing(*); self; end end
def initialize(*block_args, &block)
def initialize(*block_args, &block) @block_args = block_args @block = block ignore_macro_methods capture_added_methods(singletons_singleton_class, singleton_methods) capture_added_methods(singleton_class, instance_methods) singleton_class.class_exec(*block_args, &block) end
def instance_methods
def instance_methods @instance_methods ||= [] end
def singleton_class
def singleton_class class << self; self; end end
def singleton_methods
def singleton_methods @singleton_methods ||= [] end
def singletons_singleton_class
def singletons_singleton_class class << singleton_class; self; end end