aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/string_inquirer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/string_inquirer.rb')
-rw-r--r--activesupport/lib/active_support/string_inquirer.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/string_inquirer.rb b/activesupport/lib/active_support/string_inquirer.rb
index bc673150d0..09e1cbb28d 100644
--- a/activesupport/lib/active_support/string_inquirer.rb
+++ b/activesupport/lib/active_support/string_inquirer.rb
@@ -8,15 +8,21 @@ module ActiveSupport
# you can call this:
#
# Rails.env.production?
+ #
+ # == Instantiating a new StringInquirer
+ #
+ # vehicle = ActiveSupport::StringInquirer.new('car')
+ # vehicle.car? # => true
+ # vehicle.bike? # => false
class StringInquirer < String
private
def respond_to_missing?(method_name, include_private = false)
- method_name[-1] == '?'
+ method_name[-1] == "?"
end
def method_missing(method_name, *arguments)
- if method_name[-1] == '?'
+ if method_name[-1] == "?"
self == method_name[0..-2]
else
super