aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/string_questioneer.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2008-06-03 17:44:56 -0500
committerDavid Heinemeier Hansson <david@loudthinking.com>2008-06-03 17:44:56 -0500
commit8afa725f4b98a6e0ceee4792e8ebaebb6189e5f6 (patch)
tree358f418791a56620c32a48776739b4fdf39d3cb0 /activesupport/lib/active_support/string_questioneer.rb
parent7cfa6ec8a37b70ec302f09929df5160ac42971e7 (diff)
downloadrails-8afa725f4b98a6e0ceee4792e8ebaebb6189e5f6.tar.gz
rails-8afa725f4b98a6e0ceee4792e8ebaebb6189e5f6.tar.bz2
rails-8afa725f4b98a6e0ceee4792e8ebaebb6189e5f6.zip
Wrapped Rails.env in StringQuestioneer so you can do Rails.env.development? [DHH]
Diffstat (limited to 'activesupport/lib/active_support/string_questioneer.rb')
-rw-r--r--activesupport/lib/active_support/string_questioneer.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/string_questioneer.rb b/activesupport/lib/active_support/string_questioneer.rb
new file mode 100644
index 0000000000..7732f8b401
--- /dev/null
+++ b/activesupport/lib/active_support/string_questioneer.rb
@@ -0,0 +1,9 @@
+class StringQuestioneer < String
+ def method_missing(method_name, *arguments)
+ if method_name.to_s.ends_with?("?")
+ self == method_name.to_s[0..-2]
+ else
+ super
+ end
+ end
+end \ No newline at end of file