README.md in multi_range-1.0.0 vs README.md in multi_range-1.1.0
- old
+ new
@@ -73,11 +73,11 @@
```
### Flatten
```rb
multi_range = MultiRange.new([1, 2, 4..6, 7, 8..12])
-multi_range.flatten.ranges
+multi_range.merge_overlaps.ranges
# => [1..2, 4..12]
```
### Overlaps?
@@ -145,40 +145,40 @@
```
### Warning
The return value may be different when there are some overlapped ranges.
-Call `flatten` if you want to merge overlapped ranges.
+Call `merge_overlaps` if you want to merge overlapped ranges.
```rb
MultiRange.new([1..5, 3..6]).to_a
# => [1, 2, 3, 4, 5, 3, 4, 5, 6]
-MultiRange.new([1..5, 3..6]).flatten.to_a
+MultiRange.new([1..5, 3..6]).merge_overlaps.to_a
# => [1, 2, 3, 4, 5, 6]
```
```rb
MultiRange.new([1..5, 3..6]).each{|s| print s }
# => 123453456
-MultiRange.new([1..5, 3..6]).flatten.each{|s| print s }
+MultiRange.new([1..5, 3..6]).merge_overlaps.each{|s| print s }
# => 123456
```
```rb
MultiRange.new([1..5, 3..6]).map{|s| s * 2 }
# => [2, 4, 6, 8, 10, 6, 8, 10, 12]
-MultiRange.new([1..5, 3..6]).flatten.map{|s| s * 2 }
+MultiRange.new([1..5, 3..6]).merge_overlaps.map{|s| s * 2 }
# => [2, 4, 6, 8, 10, 12]
```
```rb
MultiRange.new([1..5, 3..6]).size
# => 9
-MultiRange.new([1..5, 3..6]).flatten.size
+MultiRange.new([1..5, 3..6]).merge_overlaps.size
# => 6
```
## Development