kyrylo / fast_method_source

Retrieve methods' and procs' source and comments
zlib License
11 stars 0 forks source link

Methods inside messages delimited with `<<-MESSAGE` aren't escaped #3

Open SandNerd opened 8 years ago

SandNerd commented 8 years ago

This method in Devise code provides an example where FastMethodSource.source_for(DeviseController.instance_method(:assert_is_devise_resource!)) returns only this part:

  def assert_is_devise_resource! #:nodoc:
    unknown_action! <<-MESSAGE unless devise_mapping
Could not find devise mapping for path #{request.fullpath.inspect}.
This may happen for two reasons:

1) You forgot to wrap your route inside the scope block. For example:

  devise_scope :user do
    get "/some/route" => "some_devise_controller"
  end

Similar delimeters have the same problem. This can especially be problematic for methods containing class_eval <<-RUBY which I've seen quite often.

kyrylo commented 8 years ago

Thanks for the bug report. I'd be happy to accept a patch fixing this issue :)