Class/Module Index [+]

Quicksearch

RR::MethodDispatches::MethodMissingDispatch

Attributes

method_name[R]
subject[R]

Public Class Methods

new(subject, method_name, args, block) click to toggle source
# File lib/rr/method_dispatches/method_missing_dispatch.rb, line 11
def initialize(subject, method_name, args, block)
  @subject, @method_name, @args, @block = subject, method_name, args, block
end
original_method_missing_alias_name() click to toggle source
# File lib/rr/method_dispatches/method_missing_dispatch.rb, line 5
def original_method_missing_alias_name
  "__rr__original_method_missing"
end

Public Instance Methods

call() click to toggle source
# File lib/rr/method_dispatches/method_missing_dispatch.rb, line 15
def call
  if Injections::DoubleInjection.exists?(subject, method_name)
    space.record_call(subject, method_name, args, block)
    @double = find_double_to_attempt

    if double
      double.method_call(args)
      call_yields
      return_value = extract_subject_from_return_value(call_implementation)
      if after_call_proc
        extract_subject_from_return_value(after_call_proc.call(return_value))
      else
        return_value
      end
    else
      double_not_found_error
    end
  else
    call_original_method
  end
end
call_original_method() click to toggle source
# File lib/rr/method_dispatches/method_missing_dispatch.rb, line 37
def call_original_method
  double_injection.bypass_bound_method do
    call_original_method_missing
  end
end

Protected Instance Methods

call_implementation() click to toggle source
# File lib/rr/method_dispatches/method_missing_dispatch.rb, line 44
def call_implementation
  if implementation_is_original_method?
    call_original_method
  else
    nil
  end
end
double_injection() click to toggle source
# File lib/rr/method_dispatches/method_missing_dispatch.rb, line 52
def double_injection
  Injections::DoubleInjection.create(subject, method_name)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.