aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2019-03-31 08:38:37 +0900
committerRyuta Kamizono <kamipo@gmail.com>2019-03-31 08:38:37 +0900
commitb89a3e7e638a50c648a17d09c48b49b707e1d90d (patch)
tree67c403d84bc17d591692610134e63ade5305761c /activesupport
parent2bf55179813190f2a79509383e21c2b43e72f4c2 (diff)
downloadrails-b89a3e7e638a50c648a17d09c48b49b707e1d90d.tar.gz
rails-b89a3e7e638a50c648a17d09c48b49b707e1d90d.tar.bz2
rails-b89a3e7e638a50c648a17d09c48b49b707e1d90d.zip
Tweaks CHANGELOGs and docs [ci skip]
* add leading `#` before `=>` since hash rocket is valid Ruby code * add backticks * remove trailing spaces * and more
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/CHANGELOG.md30
-rw-r--r--activesupport/lib/active_support/core_ext/array/access.rb8
2 files changed, 19 insertions, 19 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md
index de933ec122..6eb0af69bf 100644
--- a/activesupport/CHANGELOG.md
+++ b/activesupport/CHANGELOG.md
@@ -11,15 +11,15 @@
Before:
- (1..10).cover?(1...11) => false
+ (1..10).cover?(1...11) # => false
After:
- (1..10).cover?(1...11) => true
+ (1..10).cover?(1...11) # => true
With the same change for `Range#include?` and `Range#===`.
- *Owen Stephens*
+ *Owen Stephens*
* Use weak references in descendants tracker to allow anonymous subclasses to
be garbage collected.
@@ -36,11 +36,11 @@
* Fix `Time#advance` to work with dates before 1001-03-07
Before:
-
+
Time.utc(1001, 3, 6).advance(years: -1) # => 1000-03-05 00:00:00 UTC
-
+
After
-
+
Time.utc(1001, 3, 6).advance(years: -1) # => 1000-03-06 00:00:00 UTC
Note that this doesn't affect `DateTime#advance` as that doesn't use a proleptic calendar.
@@ -55,27 +55,27 @@
I18n.backend.store_translations(:de, i18n: { transliterate: { rule: { "ü" => "ue" } } })
- ActiveSupport::Inflector.transliterate("ü", locale: :de) => "ue"
- "Fünf autos".parameterize(locale: :de) => "fuenf-autos"
- ActiveSupport::Inflector.parameterize("Fünf autos", locale: :de) => "fuenf-autos"
+ ActiveSupport::Inflector.transliterate("ü", locale: :de) # => "ue"
+ "Fünf autos".parameterize(locale: :de) # => "fuenf-autos"
+ ActiveSupport::Inflector.parameterize("Fünf autos", locale: :de) # => "fuenf-autos"
*Kaan Ozkan*, *Sharang Dashputre*
* Allow Array#excluding and Enumerable#excluding to deal with a passed array gracefully.
- [ 1, 2, 3, 4, 5 ].excluding([4, 5]) => [ 1, 2, 3 ]
+ [ 1, 2, 3, 4, 5 ].excluding([4, 5]) # => [ 1, 2, 3 ]
*DHH*
-* Renamed Array#without and Enumerable#without to Array#excluding and Enumerable#excluding, to create parity with
- Array#including and Enumerable#including. Retained the old names as aliases.
+* Renamed `Array#without` and `Enumerable#without` to `Array#excluding` and `Enumerable#excluding`, to create parity with
+ `Array#including` and `Enumerable#including`. Retained the old names as aliases.
*DHH*
-* Added Array#including and Enumerable#including to conveniently enlarge a collection with more members using a method rather than an operator:
+* Added `Array#including` and `Enumerable#including` to conveniently enlarge a collection with more members using a method rather than an operator:
- [ 1, 2, 3 ].including(4, 5) => [ 1, 2, 3, 4, 5 ]
- post.authors.including(Current.person) => All the authors plus the current person!
+ [ 1, 2, 3 ].including(4, 5) # => [ 1, 2, 3, 4, 5 ]
+ post.authors.including(Current.person) # => All the authors plus the current person!
*DHH*
diff --git a/activesupport/lib/active_support/core_ext/array/access.rb b/activesupport/lib/active_support/core_ext/array/access.rb
index 10e4c6b09d..ea01e5891c 100644
--- a/activesupport/lib/active_support/core_ext/array/access.rb
+++ b/activesupport/lib/active_support/core_ext/array/access.rb
@@ -31,16 +31,16 @@ class Array
# Returns a new array that includes the passed elements.
#
- # [ 1, 2, 3 ].including(4, 5) => [ 1, 2, 3, 4, 5 ]
- # [ [ 0, 1 ] ].including([ [ 1, 0 ] ]) => [ [ 0, 1 ], [ 1, 0 ] ]
+ # [ 1, 2, 3 ].including(4, 5) # => [ 1, 2, 3, 4, 5 ]
+ # [ [ 0, 1 ] ].including([ [ 1, 0 ] ]) # => [ [ 0, 1 ], [ 1, 0 ] ]
def including(*elements)
self + elements.flatten(1)
end
# Returns a copy of the Array excluding the specified elements.
#
- # ["David", "Rafael", "Aaron", "Todd"].excluding("Aaron", "Todd") => ["David", "Rafael"]
- # [ [ 0, 1 ], [ 1, 0 ] ].excluding([ [ 1, 0 ] ]) => [ [ 0, 1 ] ]
+ # ["David", "Rafael", "Aaron", "Todd"].excluding("Aaron", "Todd") # => ["David", "Rafael"]
+ # [ [ 0, 1 ], [ 1, 0 ] ].excluding([ [ 1, 0 ] ]) # => [ [ 0, 1 ] ]
#
# Note: This is an optimization of <tt>Enumerable#excluding</tt> that uses <tt>Array#-</tt>
# instead of <tt>Array#reject</tt> for performance reasons.