rails/activesupport/lib/active_support/string_inquirer.rb
Henrik Hodne fa6d921e11 Remove blank trailing comments
For future reference, this is the regex I used: ^\s*#\s*\n(?!\s*#). Replace
with the first match, and voilà! Note that the regex matches a little bit too
much, so you probably want to `git add -i .` and go through every single diff
to check if it actually should be changed.
2012-05-20 01:29:13 +02:00

22 lines
521 B
Ruby

module ActiveSupport
# Wrapping a string in this class gives you a prettier way to test
# for equality. The value returned by <tt>Rails.env</tt> is wrapped
# in a StringInquirer object so instead of calling this:
#
# Rails.env == "production"
#
# you can call this:
#
# Rails.env.production?
#
class StringInquirer < String
def method_missing(method_name, *arguments)
if method_name[-1, 1] == "?"
self == method_name[0..-2]
else
super
end
end
end
end