File tree 4 files changed +22
-18
lines changed
4 files changed +22
-18
lines changed Original file line number Diff line number Diff line change 5
5
- " 2.4.0"
6
6
- " 2.5.0"
7
7
- " 2.6.0"
8
+ - ruby-head
8
9
- jruby-9.2.5.0
9
10
matrix :
10
11
allow_failures :
Original file line number Diff line number Diff line change @@ -274,8 +274,9 @@ def ==(other)
274
274
OPERATIONS = MATH_OPERATIONS . +( %i[ to step for ] ) . freeze
275
275
276
276
OPERATIONS . each do |name |
277
- define_method ( name ) { |*args , &block |
278
- @value . public_send ( name , *args , &block ) . then { |res | res . is_a? ( Value ) ? res . unwrap : res }
277
+ define_method ( name ) { |*args , **kwargs , &block |
278
+ @value . public_send ( name , *args , **kwargs , &block )
279
+ . then { |res | res . is_a? ( Value ) ? res . unwrap : res }
279
280
}
280
281
end
281
282
Original file line number Diff line number Diff line change @@ -285,7 +285,7 @@ def coerce_zones(from, to)
285
285
# Will coerce Date to Time or DateTime, with the _zone of the latter_
286
286
def coerce_date ( date , other )
287
287
TimeCalc . ( other )
288
- . merge ( Units ::DEFAULTS . merge ( year : date . year , month : date . month , day : date . day ) )
288
+ . merge ( ** Units ::DEFAULTS . merge ( year : date . year , month : date . month , day : date . day ) )
289
289
end
290
290
end
291
291
end
Original file line number Diff line number Diff line change 7
7
require 'backports/2.5.0/hash/slice'
8
8
require 'backports/2.5.0/enumerable/all'
9
9
10
- # @private
11
- # TODO: It is included in Ruby 2.7. Replace with backports when it will be there.
12
- class Enumerator
13
- NOVALUE = Object . new . freeze
14
-
15
- def self . produce ( initial = NOVALUE )
16
- fail ArgumentError , 'No block given' unless block_given?
17
-
18
- Enumerator . new do |y |
19
- val = initial == NOVALUE ? yield ( ) : initial
20
-
21
- loop do
22
- y << val
23
- val = yield ( val )
10
+ if RUBY_VERSION < '2.7'
11
+ # @private
12
+ # TODO: Replace with backports after 2.7 release
13
+ class Enumerator
14
+ NOVALUE = Object . new . freeze
15
+
16
+ def self . produce ( initial = NOVALUE )
17
+ fail ArgumentError , 'No block given' unless block_given?
18
+
19
+ Enumerator . new do |y |
20
+ val = initial == NOVALUE ? yield ( ) : initial
21
+
22
+ loop do
23
+ y << val
24
+ val = yield ( val )
25
+ end
24
26
end
25
27
end
26
28
end
@@ -118,7 +120,7 @@ def truncate(unit)
118
120
. drop_while { |u | u != unit }
119
121
. drop ( 1 )
120
122
. then { |keys | Units ::DEFAULTS . slice ( *keys ) }
121
- . then ( &method ( :merge ) )
123
+ . then { | attrs | merge ( ** attrs ) } # can't simplify to &method(:merge) due to 2.7 keyword param problem
122
124
end
123
125
124
126
alias floor truncate
You can’t perform that action at this time.
0 commit comments