|
6e85f148
»
|
josh |
2008-06-04 |
Namespaced StringQuestionee... |
1 |
module ActiveSupport |
|
6ef35461
»
|
lifo |
2008-09-03 |
Merge docrails |
2 |
# Wrapping a string in this class gives you a prettier way to test |
| |
3 |
# for equality. The value returned by <tt>Rails.env</tt> is wrapped |
| |
4 |
# in a StringInquirer object so instead of calling this: |
| |
5 |
# |
| |
6 |
# Rails.env == "production" |
| |
7 |
# |
| |
8 |
# you can call this: |
| |
9 |
# |
| |
10 |
# Rails.env.production? |
| |
11 |
# |
|
5fe28789
»
|
josh |
2008-06-04 |
Renamed StringQuestioneer t...  |
12 |
class StringInquirer < String |
|
6e85f148
»
|
josh |
2008-06-04 |
Namespaced StringQuestionee... |
13 |
def method_missing(method_name, *arguments) |
|
ef53d915
»
|
tarmo |
2008-10-30 |
Don't rely on string CoreEx... |
14 |
if method_name.to_s[-1,1] == "?" |
|
6e85f148
»
|
josh |
2008-06-04 |
Namespaced StringQuestionee... |
15 |
self == method_name.to_s[0..-2] |
| |
16 |
else |
| |
17 |
super |
| |
18 |
end |
|
8afa725f
»
|
dhh |
2008-06-03 |
Wrapped Rails.env in String...  |
19 |
end |
| |
20 |
end |
|
6e85f148
»
|
josh |
2008-06-04 |
Namespaced StringQuestionee... |
21 |
end |