From d1575ae1b9658c91145d6a46ec2a144a5a089207 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 12 Apr 2011 00:23:07 +0200 Subject: Change Object#either? to Object#among? -- thanks to @jamesarosen for the suggestion! --- railties/lib/rails/commands.rb | 2 +- railties/lib/rails/commands/benchmarker.rb | 2 +- railties/lib/rails/commands/destroy.rb | 2 +- railties/lib/rails/commands/generate.rb | 2 +- railties/lib/rails/commands/profiler.rb | 2 +- railties/lib/rails/generators/base.rb | 2 +- railties/lib/rails/generators/generated_attribute.rb | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) (limited to 'railties/lib') diff --git a/railties/lib/rails/commands.rb b/railties/lib/rails/commands.rb index 28dff23890..7108d4157e 100644 --- a/railties/lib/rails/commands.rb +++ b/railties/lib/rails/commands.rb @@ -71,7 +71,7 @@ when '--version', '-v' require 'rails/commands/application' else - puts "Error: Command not recognized" unless command.either?('-h', '--help') + puts "Error: Command not recognized" unless command.among?('-h', '--help') puts <<-EOT Usage: rails COMMAND [ARGS] diff --git a/railties/lib/rails/commands/benchmarker.rb b/railties/lib/rails/commands/benchmarker.rb index ecdcccfd8d..e10ec8fd38 100644 --- a/railties/lib/rails/commands/benchmarker.rb +++ b/railties/lib/rails/commands/benchmarker.rb @@ -1,6 +1,6 @@ require 'active_support/core_ext/object/inclusion' -if ARGV.first.either?(nil, "-h", "--help") +if ARGV.first.among?(nil, "-h", "--help") puts "Usage: rails benchmarker [times] 'Person.expensive_way' 'Person.another_expensive_way' ..." exit 1 end diff --git a/railties/lib/rails/commands/destroy.rb b/railties/lib/rails/commands/destroy.rb index 829d29dad7..d082ba592c 100644 --- a/railties/lib/rails/commands/destroy.rb +++ b/railties/lib/rails/commands/destroy.rb @@ -3,7 +3,7 @@ require 'active_support/core_ext/object/inclusion' Rails::Generators.configure! -if ARGV.first.either?(nil, "-h", "--help") +if ARGV.first.among?(nil, "-h", "--help") Rails::Generators.help 'destroy' exit end diff --git a/railties/lib/rails/commands/generate.rb b/railties/lib/rails/commands/generate.rb index bef4c6df14..789e5ebedb 100644 --- a/railties/lib/rails/commands/generate.rb +++ b/railties/lib/rails/commands/generate.rb @@ -3,7 +3,7 @@ require 'active_support/core_ext/object/inclusion' Rails::Generators.configure! -if ARGV.first.either?(nil, "-h", "--help") +if ARGV.first.among?(nil, "-h", "--help") Rails::Generators.help 'generate' exit end diff --git a/railties/lib/rails/commands/profiler.rb b/railties/lib/rails/commands/profiler.rb index baa3baaec0..d3195a204e 100644 --- a/railties/lib/rails/commands/profiler.rb +++ b/railties/lib/rails/commands/profiler.rb @@ -1,6 +1,6 @@ require 'active_support/core_ext/object/inclusion' -if ARGV.first.either?(nil, "-h", "--help") +if ARGV.first.among?(nil, "-h", "--help") $stderr.puts "Usage: rails profiler 'Person.expensive_method(10)' [times] [flat|graph|graph_html]" exit(1) end diff --git a/railties/lib/rails/generators/base.rb b/railties/lib/rails/generators/base.rb index e2c19340f4..2b0eaea3a4 100644 --- a/railties/lib/rails/generators/base.rb +++ b/railties/lib/rails/generators/base.rb @@ -165,7 +165,7 @@ module Rails names.each do |name| defaults = if options[:type] == :boolean { } - elsif default_value_for_option(name, options).either?(true, false) + elsif default_value_for_option(name, options).among?(true, false) { :banner => "" } else { :desc => "#{name.to_s.humanize} to be invoked", :banner => "NAME" } diff --git a/railties/lib/rails/generators/generated_attribute.rb b/railties/lib/rails/generators/generated_attribute.rb index 8ed3b18872..f85375b2a3 100644 --- a/railties/lib/rails/generators/generated_attribute.rb +++ b/railties/lib/rails/generators/generated_attribute.rb @@ -45,7 +45,7 @@ module Rails end def reference? - self.type.either?(:references, :belongs_to) + self.type.among?(:references, :belongs_to) end end end -- cgit v1.2.3