mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
add CHANGELOG/Doc
This commit is contained in:
parent
0fcb921a65
commit
e04a79e772
2 changed files with 23 additions and 7 deletions
|
@ -1,3 +1,14 @@
|
|||
* Allow Range#=== and Range#cover? on Range
|
||||
|
||||
`Range#cover?` can now accept a range argument like `Range#include?` and
|
||||
`Range#===`. `Range#===` works correctly on Ruby 2.6. `Range#include?` is moved
|
||||
into a new file, with these two methods.
|
||||
|
||||
*Requiring active_support/core_ext/range/include_range is now deprecated.*
|
||||
*Use `require "active_support/core_ext/range/compare_range"` instead.*
|
||||
|
||||
*utilum*
|
||||
|
||||
* Add `index_with` to Enumerable.
|
||||
|
||||
Allows creating a hash from an enumerable with the value from a passed block
|
||||
|
|
|
@ -2889,9 +2889,9 @@ As the example depicts, the `:db` format generates a `BETWEEN` SQL clause. That
|
|||
|
||||
NOTE: Defined in `active_support/core_ext/range/conversions.rb`.
|
||||
|
||||
### `include?`
|
||||
### `===`, `include?`, and `cover?`
|
||||
|
||||
The methods `Range#include?` and `Range#===` say whether some value falls between the ends of a given instance:
|
||||
The methods `Range#===`, `Range#include?`, and `Range#cover?` say whether some value falls between the ends of a given instance:
|
||||
|
||||
```ruby
|
||||
(2..3).include?(Math::E) # => true
|
||||
|
@ -2900,18 +2900,23 @@ The methods `Range#include?` and `Range#===` say whether some value falls betwee
|
|||
Active Support extends these methods so that the argument may be another range in turn. In that case we test whether the ends of the argument range belong to the receiver themselves:
|
||||
|
||||
```ruby
|
||||
(1..10) === (3..7) # => true
|
||||
(1..10) === (0..7) # => false
|
||||
(1..10) === (3..11) # => false
|
||||
(1...9) === (3..9) # => false
|
||||
|
||||
(1..10).include?(3..7) # => true
|
||||
(1..10).include?(0..7) # => false
|
||||
(1..10).include?(3..11) # => false
|
||||
(1...9).include?(3..9) # => false
|
||||
|
||||
(1..10) === (3..7) # => true
|
||||
(1..10) === (0..7) # => false
|
||||
(1..10) === (3..11) # => false
|
||||
(1...9) === (3..9) # => false
|
||||
(1..10).cover?(3..7) # => true
|
||||
(1..10).cover?(0..7) # => false
|
||||
(1..10).cover?(3..11) # => false
|
||||
(1...9).cover?(3..9) # => false
|
||||
```
|
||||
|
||||
NOTE: Defined in `active_support/core_ext/range/include_range.rb`.
|
||||
NOTE: Defined in `active_support/core_ext/range/compare_range.rb`.
|
||||
|
||||
### `overlaps?`
|
||||
|
||||
|
|
Loading…
Reference in a new issue