Skip to content

Commit 6054715

Browse files
committed
Add backwards compatibility to Ruby 2.6
This removes use of the "anonymous block argument" feature which is only supported in Ruby 3.1+ so that the library stays backwards compatible to earlier ruby versions.
1 parent ee21ea6 commit 6054715

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

.github/workflows/tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
strategy:
4444
matrix:
4545
rails: ['6.1', '7.0', '7.1']
46-
ruby: ['3.1', '3.2', '3.3']
46+
ruby: ['2.6', '2.7', '3.0', '3.1', '3.2', '3.3']
4747
runs-on: ubuntu-latest
4848
env:
4949
RAILS_VERSION: ${{ matrix.rails }}

lib/ice_cube/input_alignment.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ def initialize(rule, value, rule_part)
88

99
attr_reader :rule, :value, :rule_part
1010

11-
def verify(freq, options = {}, &)
11+
def verify(freq, options = {}, &block)
1212
@rule.validations[:interval] or return
1313

1414
case @rule
1515
when DailyRule
16-
verify_wday_alignment(freq, &)
16+
verify_wday_alignment(freq, &block)
1717
when MonthlyRule
18-
verify_month_alignment(freq, &)
18+
verify_month_alignment(freq, &block)
1919
else
20-
verify_freq_alignment(freq, &)
20+
verify_freq_alignment(freq, &block)
2121
end
2222
end
2323

lib/ice_cube/schedule.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ def all_occurrences_enumerator
160160
end
161161

162162
# Iterate forever
163-
def each_occurrence(&)
164-
enumerate_occurrences(start_time, &).to_a
163+
def each_occurrence(&block)
164+
enumerate_occurrences(start_time, &block).to_a
165165
self
166166
end
167167

0 commit comments

Comments
 (0)