mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Renamed StringQuestioneer to StringInquirer.
This commit is contained in:
parent
6e85f14817
commit
5fe2878973
7 changed files with 20 additions and 20 deletions
|
@ -4,7 +4,7 @@
|
|||
|
||||
* Namespace Inflector, Dependencies, OrderedOptions, and TimeZone under ActiveSupport [Josh Peek]
|
||||
|
||||
* Added StringQuestioneer for doing things like StringQuestioneer.new("production").production? # => true and StringQuestioneer.new("production").development? # => false [DHH]
|
||||
* Added StringInquirer for doing things like StringInquirer.new("production").production? # => true and StringInquirer.new("production").development? # => false [DHH]
|
||||
|
||||
* Fixed Date#end_of_quarter to not blow up on May 31st [#289 state:resolved] (Danger)
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ require 'active_support/ordered_hash'
|
|||
require 'active_support/ordered_options'
|
||||
require 'active_support/option_merger'
|
||||
|
||||
require 'active_support/string_questioneer'
|
||||
require 'active_support/string_inquirer'
|
||||
|
||||
require 'active_support/values/time_zone'
|
||||
require 'active_support/duration'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module ActiveSupport
|
||||
class StringQuestioneer < String
|
||||
class StringInquirer < String
|
||||
def method_missing(method_name, *arguments)
|
||||
if method_name.to_s.ends_with?("?")
|
||||
self == method_name.to_s[0..-2]
|
15
activesupport/test/string_inquirer_test.rb
Normal file
15
activesupport/test/string_inquirer_test.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
require 'abstract_unit'
|
||||
|
||||
class StringInquirerTest < Test::Unit::TestCase
|
||||
def test_match
|
||||
assert ActiveSupport::StringInquirer.new("production").production?
|
||||
end
|
||||
|
||||
def test_miss
|
||||
assert !ActiveSupport::StringInquirer.new("production").development?
|
||||
end
|
||||
|
||||
def test_missing_question_mark
|
||||
assert_raises(NoMethodError) { ActiveSupport::StringInquirer.new("production").production }
|
||||
end
|
||||
end
|
|
@ -1,15 +0,0 @@
|
|||
require 'abstract_unit'
|
||||
|
||||
class StringQuestioneerTest < Test::Unit::TestCase
|
||||
def test_match
|
||||
assert ActiveSupport::StringQuestioneer.new("production").production?
|
||||
end
|
||||
|
||||
def test_miss
|
||||
assert !ActiveSupport::StringQuestioneer.new("production").development?
|
||||
end
|
||||
|
||||
def test_missing_question_mark
|
||||
assert_raises(NoMethodError) { ActiveSupport::StringQuestioneer.new("production").production }
|
||||
end
|
||||
end
|
|
@ -1,6 +1,6 @@
|
|||
*Edge*
|
||||
|
||||
* Wrapped Rails.env in StringQuestioneer so you can do Rails.env.development? [DHH]
|
||||
* Wrapped Rails.env in StringInquirer so you can do Rails.env.development? [DHH]
|
||||
|
||||
* Fixed that RailsInfoController wasn't considering all requests local in development mode (Edgard Castro) [#310 state:resolved]
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ module Rails
|
|||
end
|
||||
|
||||
def env
|
||||
ActiveSupport::StringQuestioneer.new(RAILS_ENV)
|
||||
ActiveSupport::StringInquirer.new(RAILS_ENV)
|
||||
end
|
||||
|
||||
def cache
|
||||
|
|
Loading…
Reference in a new issue