diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2008-06-03 17:44:56 -0500 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2008-06-03 17:44:56 -0500 |
commit | 8afa725f4b98a6e0ceee4792e8ebaebb6189e5f6 (patch) | |
tree | 358f418791a56620c32a48776739b4fdf39d3cb0 /activesupport/lib | |
parent | 7cfa6ec8a37b70ec302f09929df5160ac42971e7 (diff) | |
download | rails-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')
-rw-r--r-- | activesupport/lib/active_support.rb | 2 | ||||
-rw-r--r-- | activesupport/lib/active_support/string_questioneer.rb | 9 |
2 files changed, 11 insertions, 0 deletions
diff --git a/activesupport/lib/active_support.rb b/activesupport/lib/active_support.rb index 982adfb0cf..2b418a1bb7 100644 --- a/activesupport/lib/active_support.rb +++ b/activesupport/lib/active_support.rb @@ -43,6 +43,8 @@ require 'active_support/ordered_hash' require 'active_support/ordered_options' require 'active_support/option_merger' +require 'active_support/string_questioneer' + require 'active_support/values/time_zone' require 'active_support/duration' 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 |