public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Wrapped Rails.env in StringQuestioneer so you can do 
Rails.env.development? [DHH]
dhh (author)
Tue Jun 03 15:44:56 -0700 2008
commit  8afa725f4b98a6e0ceee4792e8ebaebb6189e5f6
tree    358f418791a56620c32a48776739b4fdf39d3cb0
parent  7cfa6ec8a37b70ec302f09929df5160ac42971e7
...
4
5
6
 
 
7
8
9
...
4
5
6
7
8
9
10
11
0
@@ -4,6 +4,8 @@
0
 
0
 * Namespace Inflector, Dependencies, OrderedOptions, and TimeZone under ActiveSupport [Josh Peek]
0
 
0
+* Added StringQuestioneer for doing things like StringQuestioneer.new("production").production? # => true and StringQuestioneer.new("production").development? # => false [DHH]
0
+
0
 * Fixed Date#end_of_quarter to not blow up on May 31st [#289 state:resolved] (Danger)
0
 
0
 
...
43
44
45
 
 
46
47
48
...
43
44
45
46
47
48
49
50
0
@@ -43,6 +43,8 @@ require 'active_support/ordered_hash'
0
 require 'active_support/ordered_options'
0
 require 'active_support/option_merger'
0
 
0
+require 'active_support/string_questioneer'
0
+
0
 require 'active_support/values/time_zone'
0
 require 'active_support/duration'
0
 
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 *Edge*
0
 
0
+* Wrapped Rails.env in StringQuestioneer so you can do Rails.env.development? [DHH]
0
+
0
 * Fixed that RailsInfoController wasn't considering all requests local in development mode (Edgard Castro) [#310 state:resolved]
0
 
0
 
...
37
38
39
40
 
41
42
43
...
37
38
39
 
40
41
42
43
0
@@ -37,7 +37,7 @@ module Rails
0
     end
0
   
0
     def env
0
- RAILS_ENV
0
+ StringQuestioneer.new(RAILS_ENV)
0
     end
0
   
0
     def cache

Comments

  • henrik Wed Jun 04 02:11:28 -0700 2008

    Nice, but the name “StringQuestioneer” strikes me as very odd. Is this intended to be like trainer/trainee? “Someone being questioned”? I would probably go with StringQuestioner with one “e”.

  • yizzreel Wed Jun 04 02:26:15 -0700 2008

    Very simple and very handy, I like it.

    I had implemented slightly the same in my local clone, but extending the RAILS_ENV string inside the env method, It was ugly but worked. A separate class seems more appropiate, specially for testing.

  • josh Wed Jun 04 07:32:31 -0700 2008

    David, how about StringInquirer?

  • quirkey Wed Jun 04 08:39:26 -0700 2008

    +1 for StringInquirer

  • josh Wed Jun 04 10:56:59 -0700 2008

    Need to namespace that too.