Method: RJR::HandlesMethods::ClassMethods#dispatch_to

Defined in:
lib/rjr/util/handles_methods.rb

#dispatch_to(dispatcher) ⇒ Object

Register locally stored methods w/ the specified dispatcher



99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/rjr/util/handles_methods.rb', line 99

def dispatch_to(dispatcher)
  @jr_method_args.each { |args|
    # copy args so original is preserved
    handler_method, jr_methods =
      extract_handler_method(Array.new(args))
    jr_methods.map! { |m| m.to_s }

    handler = has_handler_for?(handler_method) ?
                   handler_for(handler_method) :
            create_handler_for(handler_method)

    dispatcher.handle jr_methods, handler
  }
end