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/conversions.rb6
-rw-r--r--activesupport/lib/active_support/core_ext/date/calculations.rb2
-rw-r--r--activesupport/lib/active_support/core_ext/hash/conversions.rb4
-rw-r--r--activesupport/lib/active_support/core_ext/time/zones.rb2
-rw-r--r--activesupport/lib/active_support/inflector/methods.rb6
-rw-r--r--activesupport/lib/active_support/testing/mocha_module.rb2
-rw-r--r--activesupport/lib/active_support/testing/tagged_logging.rb4
7 files changed, 14 insertions, 12 deletions
diff --git a/activesupport/lib/active_support/core_ext/array/conversions.rb b/activesupport/lib/active_support/core_ext/array/conversions.rb
index 6a0c4a015a..ff06436bd6 100644
--- a/activesupport/lib/active_support/core_ext/array/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/array/conversions.rb
@@ -194,7 +194,7 @@ class Array
options = options.dup
options[:indent] ||= 2
- options[:builder] ||= Builder::XmlMarkup.new(:indent => options[:indent])
+ options[:builder] ||= Builder::XmlMarkup.new(indent: options[:indent])
options[:root] ||= \
if first.class != Hash && all? { |e| e.is_a?(first.class) }
underscored = ActiveSupport::Inflector.underscore(first.class.name)
@@ -208,12 +208,12 @@ class Array
root = ActiveSupport::XmlMini.rename_key(options[:root].to_s, options)
children = options.delete(:children) || root.singularize
- attributes = options[:skip_types] ? {} : {:type => 'array'}
+ attributes = options[:skip_types] ? {} : { type: 'array' }
if empty?
builder.tag!(root, attributes)
else
- builder.__send__(:method_missing, root, attributes) do
+ builder.tag!(root, attributes) do
each { |value| ActiveSupport::XmlMini.to_tag(children, value, options) }
yield builder if block_given?
end
diff --git a/activesupport/lib/active_support/core_ext/date/calculations.rb b/activesupport/lib/active_support/core_ext/date/calculations.rb
index 02ae57b4a6..439d380af7 100644
--- a/activesupport/lib/active_support/core_ext/date/calculations.rb
+++ b/activesupport/lib/active_support/core_ext/date/calculations.rb
@@ -8,6 +8,8 @@ require 'active_support/core_ext/date_and_time/calculations'
class Date
include DateAndTime::Calculations
+ @beginning_of_week_default = nil
+
class << self
attr_accessor :beginning_of_week_default
diff --git a/activesupport/lib/active_support/core_ext/hash/conversions.rb b/activesupport/lib/active_support/core_ext/hash/conversions.rb
index f5e3a9b842..0e7bb179bf 100644
--- a/activesupport/lib/active_support/core_ext/hash/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/hash/conversions.rb
@@ -74,14 +74,14 @@ class Hash
options = options.dup
options[:indent] ||= 2
options[:root] ||= 'hash'
- options[:builder] ||= Builder::XmlMarkup.new(:indent => options[:indent])
+ options[:builder] ||= Builder::XmlMarkup.new(indent: options[:indent])
builder = options[:builder]
builder.instruct! unless options.delete(:skip_instruct)
root = ActiveSupport::XmlMini.rename_key(options[:root].to_s, options)
- builder.__send__(:method_missing, root) do
+ builder.tag!(root) do
each { |key, value| ActiveSupport::XmlMini.to_tag(key, value, options) }
yield builder if block_given?
end
diff --git a/activesupport/lib/active_support/core_ext/time/zones.rb b/activesupport/lib/active_support/core_ext/time/zones.rb
index 139d48f59c..796c5f9805 100644
--- a/activesupport/lib/active_support/core_ext/time/zones.rb
+++ b/activesupport/lib/active_support/core_ext/time/zones.rb
@@ -1,6 +1,8 @@
require 'active_support/time_with_zone'
class Time
+ @zone_default = nil
+
class << self
attr_accessor :zone_default
diff --git a/activesupport/lib/active_support/inflector/methods.rb b/activesupport/lib/active_support/inflector/methods.rb
index 3910a2dc42..1eb2b4212b 100644
--- a/activesupport/lib/active_support/inflector/methods.rb
+++ b/activesupport/lib/active_support/inflector/methods.rb
@@ -286,10 +286,12 @@ module ActiveSupport
# ordinal(-11) # => "th"
# ordinal(-1021) # => "st"
def ordinal(number)
- if (11..13).include?(number.to_i.abs % 100)
+ abs_number = number.to_i.abs
+
+ if (11..13).include?(abs_number % 100)
"th"
else
- case number.to_i.abs % 10
+ case abs_number % 10
when 1; "st"
when 2; "nd"
when 3; "rd"
diff --git a/activesupport/lib/active_support/testing/mocha_module.rb b/activesupport/lib/active_support/testing/mocha_module.rb
index ed2942d23a..833dc867f0 100644
--- a/activesupport/lib/active_support/testing/mocha_module.rb
+++ b/activesupport/lib/active_support/testing/mocha_module.rb
@@ -2,7 +2,7 @@ module ActiveSupport
module Testing
module MochaModule
begin
- require 'mocha_standalone'
+ require 'mocha/api'
include Mocha::API
def before_setup
diff --git a/activesupport/lib/active_support/testing/tagged_logging.rb b/activesupport/lib/active_support/testing/tagged_logging.rb
index 899467c45f..8ea2605733 100644
--- a/activesupport/lib/active_support/testing/tagged_logging.rb
+++ b/activesupport/lib/active_support/testing/tagged_logging.rb
@@ -1,10 +1,6 @@
-require 'active_support/concern'
-
module ActiveSupport
module Testing
module TaggedLogging
- extend ActiveSupport::Concern
-
attr_writer :tagged_logger
def before_setup