aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2008-06-04 15:02:51 -0500
committerJoshua Peek <josh@joshpeek.com>2008-06-04 15:02:51 -0500
commit6e85f14817cddb53875e572770bf3739f82e155f (patch)
treed991e72beda00d32269b5b7fc1c45cffdf28091e
parent1e4fae42d49256c925c43ea109a16a86961d47bd (diff)
downloadrails-6e85f14817cddb53875e572770bf3739f82e155f.tar.gz
rails-6e85f14817cddb53875e572770bf3739f82e155f.tar.bz2
rails-6e85f14817cddb53875e572770bf3739f82e155f.zip
Namespaced StringQuestioneer under ActiveSupport.
-rw-r--r--activesupport/lib/active_support/string_questioneer.rb16
-rw-r--r--activesupport/test/string_questioneer_test.rb6
-rw-r--r--railties/lib/initializer.rb2
3 files changed, 13 insertions, 11 deletions
diff --git a/activesupport/lib/active_support/string_questioneer.rb b/activesupport/lib/active_support/string_questioneer.rb
index 7732f8b401..666f3c6018 100644
--- a/activesupport/lib/active_support/string_questioneer.rb
+++ b/activesupport/lib/active_support/string_questioneer.rb
@@ -1,9 +1,11 @@
-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
+module ActiveSupport
+ 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
-end \ No newline at end of file
+end
diff --git a/activesupport/test/string_questioneer_test.rb b/activesupport/test/string_questioneer_test.rb
index ff9d2c17f9..51a7e399e7 100644
--- a/activesupport/test/string_questioneer_test.rb
+++ b/activesupport/test/string_questioneer_test.rb
@@ -2,14 +2,14 @@ require 'abstract_unit'
class StringQuestioneerTest < Test::Unit::TestCase
def test_match
- assert StringQuestioneer.new("production").production?
+ assert ActiveSupport::StringQuestioneer.new("production").production?
end
def test_miss
- assert !StringQuestioneer.new("production").development?
+ assert !ActiveSupport::StringQuestioneer.new("production").development?
end
def test_missing_question_mark
- assert_raises(NoMethodError) { StringQuestioneer.new("production").production }
+ assert_raises(NoMethodError) { ActiveSupport::StringQuestioneer.new("production").production }
end
end \ No newline at end of file
diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb
index dd6a0c66f5..5c927ceddf 100644
--- a/railties/lib/initializer.rb
+++ b/railties/lib/initializer.rb
@@ -37,7 +37,7 @@ module Rails
end
def env
- StringQuestioneer.new(RAILS_ENV)
+ ActiveSupport::StringQuestioneer.new(RAILS_ENV)
end
def cache