aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/array
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/core_ext/array')
-rw-r--r--activesupport/lib/active_support/core_ext/array/conversions.rb28
-rw-r--r--activesupport/lib/active_support/core_ext/array/inquiry.rb2
-rw-r--r--activesupport/lib/active_support/core_ext/array/prepend_and_append.rb2
3 files changed, 16 insertions, 16 deletions
diff --git a/activesupport/lib/active_support/core_ext/array/conversions.rb b/activesupport/lib/active_support/core_ext/array/conversions.rb
index 54fb83581a..1d4c83ae52 100644
--- a/activesupport/lib/active_support/core_ext/array/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/array/conversions.rb
@@ -1,8 +1,8 @@
-require 'active_support/xml_mini'
-require 'active_support/core_ext/hash/keys'
-require 'active_support/core_ext/string/inflections'
-require 'active_support/core_ext/object/to_param'
-require 'active_support/core_ext/object/to_query'
+require "active_support/xml_mini"
+require "active_support/core_ext/hash/keys"
+require "active_support/core_ext/string/inflections"
+require "active_support/core_ext/object/to_param"
+require "active_support/core_ext/object/to_query"
class Array
# Converts the array to a comma-separated sentence where the last element is
@@ -66,9 +66,9 @@ class Array
options.assert_valid_keys(:words_connector, :two_words_connector, :last_word_connector, :locale, :fallback_string)
default_connectors = {
- :words_connector => ', ',
- :two_words_connector => ' and ',
- :last_word_connector => ', and '
+ words_connector: ", ",
+ two_words_connector: " and ",
+ last_word_connector: ", and "
}
if defined?(I18n)
i18n_connectors = I18n.translate(:'support.array', locale: options[:locale], default: {})
@@ -98,9 +98,9 @@ class Array
case format
when :db
if empty?
- 'null'
+ "null"
else
- collect(&:id).join(',')
+ collect(&:id).join(",")
end
else
to_default_s
@@ -185,7 +185,7 @@ class Array
# </messages>
#
def to_xml(options = {})
- require 'active_support/builder' unless defined?(Builder)
+ require "active_support/builder" unless defined?(Builder)
options = options.dup
options[:indent] ||= 2
@@ -193,9 +193,9 @@ class Array
options[:root] ||= \
if first.class != Hash && all? { |e| e.is_a?(first.class) }
underscored = ActiveSupport::Inflector.underscore(first.class.name)
- ActiveSupport::Inflector.pluralize(underscored).tr('/', '_')
+ ActiveSupport::Inflector.pluralize(underscored).tr("/", "_")
else
- 'objects'
+ "objects"
end
builder = options[:builder]
@@ -203,7 +203,7 @@ 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)
diff --git a/activesupport/lib/active_support/core_ext/array/inquiry.rb b/activesupport/lib/active_support/core_ext/array/inquiry.rb
index e8f44cc378..66fa5fcd0c 100644
--- a/activesupport/lib/active_support/core_ext/array/inquiry.rb
+++ b/activesupport/lib/active_support/core_ext/array/inquiry.rb
@@ -1,4 +1,4 @@
-require 'active_support/array_inquirer'
+require "active_support/array_inquirer"
class Array
# Wraps the array in an +ArrayInquirer+ object, which gives a friendlier way
diff --git a/activesupport/lib/active_support/core_ext/array/prepend_and_append.rb b/activesupport/lib/active_support/core_ext/array/prepend_and_append.rb
index f8d48b69df..16a6789f8d 100644
--- a/activesupport/lib/active_support/core_ext/array/prepend_and_append.rb
+++ b/activesupport/lib/active_support/core_ext/array/prepend_and_append.rb
@@ -4,4 +4,4 @@ class Array
# The human way of thinking about adding stuff to the beginning of a list is with prepend.
alias_method :prepend, :unshift
-end \ No newline at end of file
+end