diff options
Diffstat (limited to 'activesupport/lib')
4 files changed, 6 insertions, 6 deletions
diff --git a/activesupport/lib/active_support/cache/file_store.rb b/activesupport/lib/active_support/cache/file_store.rb index 5eeb17efd5..bdef47a237 100644 --- a/activesupport/lib/active_support/cache/file_store.rb +++ b/activesupport/lib/active_support/cache/file_store.rb @@ -21,7 +21,7 @@ module ActiveSupport end def clear(options = nil) - root_dirs = Dir.entries(cache_path).reject{|f| f.either?('.', '..')} + root_dirs = Dir.entries(cache_path).reject{|f| f.among?('.', '..')} FileUtils.rm_r(root_dirs.collect{|f| File.join(cache_path, f)}) end @@ -162,7 +162,7 @@ module ActiveSupport # Delete empty directories in the cache. def delete_empty_directories(dir) return if dir == cache_path - if Dir.entries(dir).reject{|f| f.either?('.', '..')}.empty? + if Dir.entries(dir).reject{|f| f.among?('.', '..')}.empty? File.delete(dir) rescue nil delete_empty_directories(File.dirname(dir)) end diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index 738ce0e994..6a0bffb6d7 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -413,7 +413,7 @@ module ActiveSupport # CallbackChain. # def __update_callbacks(name, filters = [], block = nil) #:nodoc: - type = filters.first.either?(:before, :after, :around) ? filters.shift : :before + type = filters.first.among?(:before, :after, :around) ? filters.shift : :before options = filters.last.is_a?(Hash) ? filters.pop : {} filters.unshift(block) if block diff --git a/activesupport/lib/active_support/core_ext/object/inclusion.rb b/activesupport/lib/active_support/core_ext/object/inclusion.rb index 79e9fd6c88..cf89288aed 100644 --- a/activesupport/lib/active_support/core_ext/object/inclusion.rb +++ b/activesupport/lib/active_support/core_ext/object/inclusion.rb @@ -12,9 +12,9 @@ class Object # Returns true if this object is included in the argument list. Usage: # # username = "sikachu" - # username.either?("josevalim", "dhh", "wycats") # => false + # username.among?("josevalim", "dhh", "wycats") # => false # - def either?(*objects) + def among?(*objects) objects.include?(self) end end diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb index 3b053d7830..6b9120e51f 100644 --- a/activesupport/lib/active_support/time_with_zone.rb +++ b/activesupport/lib/active_support/time_with_zone.rb @@ -345,7 +345,7 @@ module ActiveSupport end def duration_of_variable_length?(obj) - ActiveSupport::Duration === obj && obj.parts.any? {|p| p[0].either?(:years, :months, :days) } + ActiveSupport::Duration === obj && obj.parts.any? {|p| p[0].among?(:years, :months, :days) } end end end |