Skip to content

Commit

Permalink
Merge pull request #27035 from rails/remove-active-support-deprecations
Browse files Browse the repository at this point in the history
Remove Active Support deprecations
  • Loading branch information
pixeltrix committed Nov 14, 2016
2 parents 3a82ad7 + 0d7bd20 commit e491b2c
Show file tree
Hide file tree
Showing 30 changed files with 76 additions and 685 deletions.
73 changes: 73 additions & 0 deletions activesupport/CHANGELOG.md
@@ -1,3 +1,76 @@
* Remove deprecated class `ActiveSupport::Concurrency::Latch`

*Andrew White*

* Remove deprecated separator argument from `parameterize`

*Andrew White*

* Remove deprecated method `Numeric#to_formatted_s`

*Andrew White*

* Remove deprecated method `alias_method_chain`

*Andrew White*

* Remove deprecated constant `MissingSourceFile`

*Andrew White*

* Remove deprecated methods `Module.qualified_const_defined?`,
`Module.qualified_const_get` and `Module.qualified_const_set`

*Andrew White*

* Remove deprecated `:prefix` option from `number_to_human_size`

*Andrew White*

* Remove deprecated method `ActiveSupport::HashWithIndifferentAccess.new_from_hash_copying_default`

*Andrew White*

* Remove deprecated method `Module.local_constants`

*Andrew White*

* Remove deprecated file `active_support/core_ext/time/marshal.rb`

*Andrew White*

* Remove deprecated file `active_support/core_ext/struct.rb`

*Andrew White*

* Remove deprecated file `active_support/core_ext/module/method_transplanting.rb`

*Andrew White*

* Remove deprecated method `Module.local_constants`

*Andrew White*

* Remove deprecated file `active_support/core_ext/kernel/debugger.rb`

*Andrew White*

* Remove deprecated method `ActiveSupport::Cache::Store#namespaced_key`

*Andrew White*

* Remove deprecated method `ActiveSupport::Cache::Strategy::LocalCache::LocalStore#set_cache_value`

*Andrew White*

* Remove deprecated method `ActiveSupport::Cache::MemCacheStore#escape_key`

*Andrew White*

* Remove deprecated method `ActiveSupport::Cache::FileStore#key_file_path`

*Andrew White*

* Ensure duration parsing is consistent across DST changes

Previously `ActiveSupport::Duration.parse` used `Time.current` and
Expand Down
8 changes: 0 additions & 8 deletions activesupport/lib/active_support/cache.rb
Expand Up @@ -549,14 +549,6 @@ def normalize_key(key, options)
key
end

def namespaced_key(*args)
ActiveSupport::Deprecation.warn(<<-MESSAGE.strip_heredoc)
`namespaced_key` is deprecated and will be removed from Rails 5.1.
Please use `normalize_key` which will return a fully resolved key.
MESSAGE
normalize_key(*args)
end

def instrument(operation, key, options = nil)
log { "Cache #{operation}: #{normalize_key(key, options)}#{options.blank? ? "" : " (#{options.inspect})"}" }

Expand Down
8 changes: 0 additions & 8 deletions activesupport/lib/active_support/cache/file_store.rb
Expand Up @@ -138,14 +138,6 @@ def normalize_key(key, options)
File.join(cache_path, DIR_FORMATTER % dir_1, DIR_FORMATTER % dir_2, *fname_paths)
end

def key_file_path(key)
ActiveSupport::Deprecation.warn(<<-MESSAGE.strip_heredoc)
`key_file_path` is deprecated and will be removed from Rails 5.1.
Please use `normalize_key` which will return a fully resolved key or nothing.
MESSAGE
key
end

# Translate a file path into a key.
def file_path_key(path)
fname = path[cache_path.to_s.size..-1].split(File::SEPARATOR, 4).last
Expand Down
8 changes: 0 additions & 8 deletions activesupport/lib/active_support/cache/mem_cache_store.rb
Expand Up @@ -181,14 +181,6 @@ def normalize_key(key, options)
key
end

def escape_key(key)
ActiveSupport::Deprecation.warn(<<-MESSAGE.strip_heredoc)
`escape_key` is deprecated and will be removed from Rails 5.1.
Please use `normalize_key` which will return a fully resolved key or nothing.
MESSAGE
key
end

def deserialize_entry(raw_value)
if raw_value
entry = Marshal.load(raw_value) rescue raw_value
Expand Down
Expand Up @@ -124,14 +124,6 @@ def delete_entry(key, options) # :nodoc:
super
end

def set_cache_value(value, name, amount, options) # :nodoc:
ActiveSupport::Deprecation.warn(<<-MESSAGE.strip_heredoc)
`set_cache_value` is deprecated and will be removed from Rails 5.1.
Please use `write_cache_value` instead.
MESSAGE
write_cache_value name, value, options
end

def write_cache_value(name, value, options) # :nodoc:
name = normalize_key(name, options)
cache = local_cache
Expand Down
25 changes: 0 additions & 25 deletions activesupport/lib/active_support/concurrency/latch.rb

This file was deleted.

3 changes: 0 additions & 3 deletions activesupport/lib/active_support/core_ext/kernel/debugger.rb

This file was deleted.

2 changes: 0 additions & 2 deletions activesupport/lib/active_support/core_ext/load_error.rb
Expand Up @@ -27,5 +27,3 @@ def is_missing?(location)
location.sub(/\.rb$/, "".freeze) == path.sub(/\.rb$/, "".freeze)
end
end

MissingSourceFile = ActiveSupport::Deprecation::DeprecatedConstantProxy.new("MissingSourceFile", "LoadError")
1 change: 0 additions & 1 deletion activesupport/lib/active_support/core_ext/module.rb
Expand Up @@ -9,4 +9,3 @@
require "active_support/core_ext/module/delegation"
require "active_support/core_ext/module/deprecation"
require "active_support/core_ext/module/remove_method"
require "active_support/core_ext/module/qualified_const"
48 changes: 0 additions & 48 deletions activesupport/lib/active_support/core_ext/module/aliasing.rb
@@ -1,52 +1,4 @@
class Module
# NOTE: This method is deprecated. Please use <tt>Module#prepend</tt> that
# comes with Ruby 2.0 or newer instead.
#
# Encapsulates the common pattern of:
#
# alias_method :foo_without_feature, :foo
# alias_method :foo, :foo_with_feature
#
# With this, you simply do:
#
# alias_method_chain :foo, :feature
#
# And both aliases are set up for you.
#
# Query and bang methods (foo?, foo!) keep the same punctuation:
#
# alias_method_chain :foo?, :feature
#
# is equivalent to
#
# alias_method :foo_without_feature?, :foo?
# alias_method :foo?, :foo_with_feature?
#
# so you can safely chain foo, foo?, foo! and/or foo= with the same feature.
def alias_method_chain(target, feature)
ActiveSupport::Deprecation.warn("alias_method_chain is deprecated. Please, use Module#prepend instead. From module, you can access the original method using super.")

# Strip out punctuation on predicates, bang or writer methods since
# e.g. target?_without_feature is not a valid method name.
aliased_target, punctuation = target.to_s.sub(/([?!=])$/, ""), $1
yield(aliased_target, punctuation) if block_given?

with_method = "#{aliased_target}_with_#{feature}#{punctuation}"
without_method = "#{aliased_target}_without_#{feature}#{punctuation}"

alias_method without_method, target
alias_method target, with_method

case
when public_method_defined?(without_method)
public target
when protected_method_defined?(without_method)
protected target
when private_method_defined?(without_method)
private target
end
end

# Allows you to make aliases for attributes, which includes
# getter, setter, and a predicate.
#
Expand Down
Expand Up @@ -55,12 +55,4 @@ def parents
parents << Object unless parents.include? Object
parents
end

def local_constants #:nodoc:
ActiveSupport::Deprecation.warn(<<-MSG.squish)
Module#local_constants is deprecated and will be removed in Rails 5.1.
Use Module#constants(false) instead.
MSG
constants(false)
end
end

This file was deleted.

This file was deleted.

Expand Up @@ -126,11 +126,6 @@ def to_s(*args)
end
end
end

def to_formatted_s(*args)
to_s(*args)
end
deprecate to_formatted_s: :to_s
end

# Ruby 2.4+ unifies Fixnum & Bignum into Integer.
Expand Down
Expand Up @@ -178,11 +178,7 @@ def deconstantize
#
# <%= link_to(@person.name, person_path) %>
# # => <a href="/person/1-Donald-E-Knuth">Donald E. Knuth</a>
def parameterize(sep = :unused, separator: "-", preserve_case: false)
unless sep == :unused
ActiveSupport::Deprecation.warn("Passing the separator argument as a positional parameter is deprecated and will soon be removed. Use `separator: '#{sep}'` instead.")
separator = sep
end
def parameterize(separator: "-", preserve_case: false)
ActiveSupport::Inflector.parameterize(self, separator: separator, preserve_case: preserve_case)
end

Expand Down
3 changes: 0 additions & 3 deletions activesupport/lib/active_support/core_ext/struct.rb

This file was deleted.

3 changes: 0 additions & 3 deletions activesupport/lib/active_support/core_ext/time/marshal.rb

This file was deleted.

1 change: 0 additions & 1 deletion activesupport/lib/active_support/dependencies.rb
Expand Up @@ -6,7 +6,6 @@
require "active_support/core_ext/module/attribute_accessors"
require "active_support/core_ext/module/introspection"
require "active_support/core_ext/module/anonymous"
require "active_support/core_ext/module/qualified_const"
require "active_support/core_ext/object/blank"
require "active_support/core_ext/kernel/reporting"
require "active_support/core_ext/load_error"
Expand Down
Expand Up @@ -84,15 +84,6 @@ def default(*args)
end
end

def self.new_from_hash_copying_default(hash)
ActiveSupport::Deprecation.warn(<<-MSG.squish)
`ActiveSupport::HashWithIndifferentAccess.new_from_hash_copying_default`
has been deprecated, and will be removed in Rails 5.1. The behavior of
this method is now identical to the behavior of `.new`.
MSG
new(hash)
end

def self.[](*args)
new.merge!(Hash[*args])
end
Expand Down
6 changes: 1 addition & 5 deletions activesupport/lib/active_support/inflector/transliterate.rb
Expand Up @@ -78,11 +78,7 @@ def transliterate(string, replacement = "?".freeze)
# parameterize("Donald E. Knuth", preserve_case: true) # => "Donald-E-Knuth"
# parameterize("^trés|Jolie-- ", preserve_case: true) # => "tres-Jolie"
#
def parameterize(string, sep = :unused, separator: "-", preserve_case: false)
unless sep == :unused
ActiveSupport::Deprecation.warn("Passing the separator argument as a positional parameter is deprecated and will soon be removed. Use `separator: '#{sep}'` instead.")
separator = sep
end
def parameterize(string, separator: "-", preserve_case: false)
# Replace accented chars with their ASCII equivalents.
parameterized_string = transliterate(string)

Expand Down

0 comments on commit e491b2c

Please sign in to comment.