Added documentation for ActiveSupport::StringInquirer class

This commit is contained in:
Pat Nakajima
2008-07-30 16:37:57 -04:00
committed by Pratik Naik
parent f6124c2b09
commit e5fadfea8a

View File

@@ -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?("?")