Class Index [+]

Quicksearch

RR::Injections::MethodMissingInjection

Public Class Methods

create(subject) click to toggle source
   # File lib/rr/injections/method_missing_injection.rb, line 5
5:         def create(subject)
6:           instances[subject] ||= begin
7:             new(subject).bind
8:           end
9:         end
exists?(subject) click to toggle source
    # File lib/rr/injections/method_missing_injection.rb, line 11
11:         def exists?(subject)
12:           instances.include?(subject)
13:         end
new(subject) click to toggle source
    # File lib/rr/injections/method_missing_injection.rb, line 16
16:       def initialize(subject)
17:         @subject = subject
18:         @placeholder_method_defined = false
19:       end

Public Instance Methods

bind() click to toggle source
    # File lib/rr/injections/method_missing_injection.rb, line 21
21:       def bind
22:         unless subject.respond_to?(original_method_alias_name)
23:           unless subject.respond_to?(:method_missing)
24:             @placeholder_method_defined = true
25:             subject_class.class_eval do
26:               def method_missing(method_name, *args, &block)
27:                 super
28:               end
29:             end
30:           end
31:           subject_class.__send__(:alias_method, original_method_alias_name, :method_missing)
32:           bind_method
33:         end
34:         self
35:       end
dispatch_method(method_name, args, block) click to toggle source
    # File lib/rr/injections/method_missing_injection.rb, line 51
51:       def dispatch_method(method_name, args, block)
52:         MethodDispatches::MethodMissingDispatch.new(subject, method_name, args, block).call
53:       end
method_missing(method_name, *args, &block) click to toggle source
    # File lib/rr/injections/method_missing_injection.rb, line 26
26:               def method_missing(method_name, *args, &block)
27:                 super
28:               end
reset() click to toggle source
    # File lib/rr/injections/method_missing_injection.rb, line 37
37:       def reset
38:         if subject_has_method_defined?(original_method_alias_name)
39:           memoized_original_method_alias_name = original_method_alias_name
40:           placeholder_method_defined = @placeholder_method_defined
41:           subject_class.class_eval do
42:             remove_method :method_missing
43:             unless placeholder_method_defined
44:               alias_method :method_missing, memoized_original_method_alias_name
45:             end
46:             remove_method memoized_original_method_alias_name
47:           end
48:         end
49:       end

Protected Instance Methods

bind_method() click to toggle source
    # File lib/rr/injections/method_missing_injection.rb, line 60
60:       def bind_method
61:         returns_method =         def method_missing(method_name, *args, &block)          RR::Injections::MethodMissingInjection.create(self).dispatch_method(method_name, args, block)        end
62:         subject_class.class_eval(returns_method, __FILE__, __LINE__ - 4)
63:       end
original_method_alias_name() click to toggle source
    # File lib/rr/injections/method_missing_injection.rb, line 69
69:       def original_method_alias_name
70:         MethodDispatches::MethodMissingDispatch.original_method_missing_alias_name
71:       end
subject_class() click to toggle source
    # File lib/rr/injections/method_missing_injection.rb, line 56
56:       def subject_class
57:         class << subject; self; end
58:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.