Skip to content

Commit

Permalink
Make sure evalled method knows where it came from
Browse files Browse the repository at this point in the history
  • Loading branch information
Yehuda Katz authored and Yehuda Katz committed Dec 29, 2009
1 parent 981f696 commit cf49783
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions actionpack/lib/action_dispatch/http/mime_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ def symbols
%w(<< concat shift unshift push pop []= clear compact! collect!
delete delete_at delete_if flatten! map! insert reject! reverse!
replace slice! sort! uniq!).each do |method|
module_eval <<-CODE
def #{method}(*args)
module_eval <<-CODE, __FILE__, __LINE__ + 1
def #{method}(*)
@symbols = nil
super
end
Expand Down

2 comments on commit cf49783

@fsvehla
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely! How about writing an example for the generated code right next to it in a comment?

@lifo
Copy link
Member

@lifo lifo commented on cf49783 Dec 29, 2009

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments for the generated code would just be noise, more so in this case!

Please sign in to comment.