aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators/base.rb
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2012-08-06 00:27:56 +0200
committerXavier Noria <fxn@hashref.com>2012-08-06 00:30:02 +0200
commit447b6a4e678ab1618bdcd130e30c288b0a25297a (patch)
tree6d9cb3417996517a5b237d3950c25ab32a5db098 /railties/lib/rails/generators/base.rb
parent6126f02cf903fa206b11d2dc2eeb5f197a29b965 (diff)
downloadrails-447b6a4e678ab1618bdcd130e30c288b0a25297a.tar.gz
rails-447b6a4e678ab1618bdcd130e30c288b0a25297a.tar.bz2
rails-447b6a4e678ab1618bdcd130e30c288b0a25297a.zip
removes usage of Object#in? from the code base (the method remains defined by Active Support)
Selecting which key extensions to include in active_support/rails made apparent the systematic usage of Object#in? in the code base. After some discussion in https://github.com/rails/rails/commit/5ea6b0df9a36d033f21b52049426257a4637028d we decided to remove it and use plain Ruby, which seems enough for this particular idiom. In this commit the refactor has been made case by case. Sometimes include? is the natural alternative, others a simple || is the way you actually spell the condition in your head, others a case statement seems more appropriate. I have chosen the one I liked the most in each case.
Diffstat (limited to 'railties/lib/rails/generators/base.rb')
-rw-r--r--railties/lib/rails/generators/base.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/railties/lib/rails/generators/base.rb b/railties/lib/rails/generators/base.rb
index a49a1724c5..a3f8ebf476 100644
--- a/railties/lib/rails/generators/base.rb
+++ b/railties/lib/rails/generators/base.rb
@@ -8,7 +8,6 @@ rescue LoadError
end
require 'rails/generators/actions'
-require 'active_support/core_ext/object/inclusion'
module Rails
module Generators
@@ -171,7 +170,7 @@ module Rails
names.each do |name|
defaults = if options[:type] == :boolean
{ }
- elsif default_value_for_option(name, options).in?([true, false])
+ elsif [true, false].include?(default_value_for_option(name, options))
{ :banner => "" }
else
{ :desc => "#{name.to_s.humanize} to be invoked", :banner => "NAME" }