Permalink
Browse files

Added documentation for ActiveSupport::StringInquirer class

  • Loading branch information...
1 parent f6124c2 commit e5fadfea8a808b145489122d2c59a92bcbb341be @nakajima nakajima committed with lifo Jul 30, 2008
Showing with 10 additions and 0 deletions.
  1. +10 −0 activesupport/lib/active_support/string_inquirer.rb
@@ -1,4 +1,14 @@
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.to_s.ends_with?("?")

0 comments on commit e5fadfe

Please sign in to comment.