aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/core_ext/array/random_access.rb12
-rw-r--r--activesupport/lib/active_support/core_ext/date/calculations.rb11
-rw-r--r--activesupport/lib/active_support/core_ext/string/encoding.rb11
-rw-r--r--activesupport/lib/active_support/core_ext/time/calculations.rb11
-rw-r--r--activesupport/lib/active_support/ruby/shim.rb1
5 files changed, 13 insertions, 33 deletions
diff --git a/activesupport/lib/active_support/core_ext/array/random_access.rb b/activesupport/lib/active_support/core_ext/array/random_access.rb
index 5338836b29..67c322daea 100644
--- a/activesupport/lib/active_support/core_ext/array/random_access.rb
+++ b/activesupport/lib/active_support/core_ext/array/random_access.rb
@@ -1,16 +1,6 @@
class Array
- # This method is deprecated because it masks Kernel#rand within the Array class itself,
- # which may be used by a 3rd party library extending Array in turn. See
- #
- # https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/4555
- #
- def rand # :nodoc:
- ActiveSupport::Deprecation.warn "Array#rand is deprecated, use random_element instead", caller
- random_element
- end
-
# Returns a random element from the array.
def random_element
self[Kernel.rand(length)]
end
-end
+end \ No newline at end of file
diff --git a/activesupport/lib/active_support/core_ext/date/calculations.rb b/activesupport/lib/active_support/core_ext/date/calculations.rb
index 755d96ce91..579079d4f1 100644
--- a/activesupport/lib/active_support/core_ext/date/calculations.rb
+++ b/activesupport/lib/active_support/core_ext/date/calculations.rb
@@ -2,7 +2,6 @@ require 'date'
require 'active_support/duration'
require 'active_support/core_ext/time/zones'
require 'active_support/core_ext/object/acts_like'
-require 'active_support/deprecation'
class Date
if RUBY_VERSION < '1.9'
@@ -147,11 +146,6 @@ class Date
advance(:years => years)
end
- def last_year # :nodoc:
- ActiveSupport::Deprecation.warn("Date#last_year has been deprecated, please use Date#prev_year instead", caller)
- prev_year
- end
-
# Shorthand for years_ago(1)
def prev_year
years_ago(1)
@@ -161,11 +155,6 @@ class Date
def next_year
years_since(1)
end unless method_defined?(:next_year)
-
- def last_month # :nodoc:
- ActiveSupport::Deprecation.warn("Date#last_month has been deprecated, please use Date#prev_month instead", caller)
- prev_month
- end
# Short-hand for months_ago(1)
def prev_month
diff --git a/activesupport/lib/active_support/core_ext/string/encoding.rb b/activesupport/lib/active_support/core_ext/string/encoding.rb
new file mode 100644
index 0000000000..d4781bfe0c
--- /dev/null
+++ b/activesupport/lib/active_support/core_ext/string/encoding.rb
@@ -0,0 +1,11 @@
+class String
+ if defined?(Encoding) && "".respond_to?(:encode)
+ def encoding_aware?
+ true
+ end
+ else
+ def encoding_aware?
+ false
+ end
+ end
+end \ No newline at end of file
diff --git a/activesupport/lib/active_support/core_ext/time/calculations.rb b/activesupport/lib/active_support/core_ext/time/calculations.rb
index e27b08ec2e..3c218d88e5 100644
--- a/activesupport/lib/active_support/core_ext/time/calculations.rb
+++ b/activesupport/lib/active_support/core_ext/time/calculations.rb
@@ -2,7 +2,6 @@ require 'active_support/duration'
require 'active_support/core_ext/date/acts_like'
require 'active_support/core_ext/date/calculations'
require 'active_support/core_ext/date_time/conversions'
-require 'active_support/deprecation'
class Time
COMMON_YEAR_DAYS_IN_MONTH = [nil, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
@@ -133,11 +132,6 @@ class Time
advance(:years => years)
end
- def last_year # :nodoc:
- ActiveSupport::Deprecation.warn("Time#last_year has been deprecated, please use Time#prev_year instead", caller)
- prev_year
- end
-
# Short-hand for years_ago(1)
def prev_year
years_ago(1)
@@ -148,11 +142,6 @@ class Time
years_since(1)
end
- def last_month # :nodoc:
- ActiveSupport::Deprecation.warn("Time#last_month has been deprecated, please use Time#prev_month instead", caller)
- prev_month
- end
-
# Short-hand for months_ago(1)
def prev_month
months_ago(1)
diff --git a/activesupport/lib/active_support/ruby/shim.rb b/activesupport/lib/active_support/ruby/shim.rb
index 4a9ac920e8..608b3fe4b9 100644
--- a/activesupport/lib/active_support/ruby/shim.rb
+++ b/activesupport/lib/active_support/ruby/shim.rb
@@ -15,6 +15,7 @@ require 'active_support/core_ext/enumerable'
require 'active_support/core_ext/process/daemon'
require 'active_support/core_ext/string/conversions'
require 'active_support/core_ext/string/interpolation'
+require 'active_support/core_ext/string/encoding'
require 'active_support/core_ext/rexml'
require 'active_support/core_ext/time/conversions'
require 'active_support/core_ext/file/path'