Permalink
Browse files

Use Array.wrap instead of using ternary

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
drogus authored and josevalim committed Dec 9, 2010
1 parent 6f89582 commit e12810178cebc0c40a90b4aba3976537852b71b4
@@ -443,7 +443,7 @@ def initialize_schema_migrations_table
end
def assume_migrated_upto_version(version, migrations_paths = ActiveRecord::Migrator.migrations_paths)
- migrations_paths = [migrations_paths] unless migrations_paths.kind_of?(Array)
+ migrations_paths = Array.wrap(migrations_paths)
version = version.to_i
sm_table = quote_table_name(ActiveRecord::Migrator.schema_migrations_table_name)
@@ -573,15 +573,15 @@ def proper_table_name(name)
def migrations_paths
@migrations_paths ||= ['db/migrate']
# just to not break things if someone uses: migration_path = some_string
- @migrations_paths.kind_of?(Array) ? @migrations_paths : [@migrations_paths]
+ Array.wrap(@migrations_paths)
end
def migrations_path
migrations_paths.first
end
def migrations(paths)
- paths = [paths] unless paths.kind_of?(Array)
+ paths = Array.wrap(paths)
files = Dir[*paths.map { |p| "#{p}/[0-9]*_*.rb" }]

1 comment on commit e128101

@carlosantoniodasilva

This comment has been minimized.

Show comment
Hide comment
@carlosantoniodasilva

carlosantoniodasilva Dec 9, 2010

Member

These files should have the require call to Array.wrap now, shouldn't they?

These files should have the require call to Array.wrap now, shouldn't they?

Please sign in to comment.