Skip to content

Commit 02ce88e

Browse files
authored
Update supported version of ruby and rails (#552)
* Updaet supported version of ruby and rails * linting * Update CHANGELOG.md * Linting * Linting * Fix spec * Update checkout action * Update changelog enforcer * Update checkout to v4
1 parent 10ae8dc commit 02ce88e

20 files changed

+55
-59
lines changed

.github/workflows/tests.yaml

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,21 @@ jobs:
1919
changelog:
2020
runs-on: ubuntu-latest
2121
steps:
22-
- uses: actions/checkout@v2
22+
- uses: actions/checkout@v4
2323
- id: read-version
2424
run: |
2525
echo "::set-output name=VERSION::`cat lib/ice_cube/version.rb | grep -i version | awk '{ print $3 }' | sed -e 's/\"//g'`"
26-
- uses: dangoslen/changelog-enforcer@v2.3.1
26+
- uses: dangoslen/changelog-enforcer@v3
2727
with:
2828
skipLabels: 'skip-changelog'
2929
expectedLatestVersion: ${{ steps.read-version.outputs.VERSION }}
3030
lint:
3131
runs-on: ubuntu-latest
3232
steps:
33-
- uses: actions/checkout@v2
33+
- uses: actions/checkout@v4
3434
- uses: ruby/setup-ruby@v1
3535
with:
36-
ruby-version: '2.6'
36+
ruby-version: '3.1'
3737
bundler-cache: true
3838
- run: bundle exec standardrb
3939
test:
@@ -42,22 +42,13 @@ jobs:
4242
- lint
4343
strategy:
4444
matrix:
45-
rails: ['5.2', '6.0.4', '6.1', '7.0']
46-
ruby: ['2.6', '2.7', '3.0', '3.1']
47-
exclude:
48-
- rails: '5.2'
49-
ruby: '3.0'
50-
- rails: '5.2'
51-
ruby: '3.1'
52-
- rails: '7.0'
53-
ruby: '2.6'
54-
- rails: '7.0'
55-
ruby: '2.7'
45+
rails: ['6.1', '7.0', '7.1']
46+
ruby: ['3.1', '3.2', '3.3']
5647
runs-on: ubuntu-latest
5748
env:
5849
RAILS_VERSION: ${{ matrix.rails }}
5950
steps:
60-
- uses: actions/checkout@v2
51+
- uses: actions/checkout@v4
6152
- uses: ruby/setup-ruby@v1
6253
with:
6354
ruby-version: ${{ matrix.ruby }}

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010

1111
### Changed
1212
- Removed use of `delegate` method added in [66f1d797](https://github.com/ice-cube-ruby/ice_cube/commit/66f1d797092734563bfabd2132c024c7d087f683) , reverting to previous implementation. ([#522](https://github.com/ice-cube-ruby/ice_cube/pull/522)) by [@pacso](https://github.com/pacso)
13+
- Updated supported versions of Ruby and Rails and fixed standardrb lint issues. ([#552](https://github.com/ice-cube-ruby/ice_cube/pull/552)) by [@pacso](https://github.com/pacso)
1314

1415
### Fixed
1516
- Fix for weekly interval results when requesting `occurrences_between` on a narrow range ([#487](https://github.com/seejohnrun/ice_cube/pull/487)) by [@jakebrady5](https://github.com/jakebrady5)

ice_cube.gemspec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ Gem::Specification.new do |s|
1717
s.version = IceCube::VERSION
1818
s.platform = Gem::Platform::RUBY
1919
s.files = Dir["lib/**/*.rb", "config/**/*.yml"]
20-
s.test_files = Dir.glob("spec/*.rb")
2120
s.require_paths = ["lib"]
2221

2322
s.add_development_dependency("rake")

lib/ice_cube/builders/string_builder.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def ordinal(number)
6161
ord = IceCube::I18n.t("ice_cube.integer.ordinals")[number] ||
6262
IceCube::I18n.t("ice_cube.integer.ordinals")[number % 10] ||
6363
IceCube::I18n.t("ice_cube.integer.ordinals")[:default]
64-
number >= 0 ? ord : IceCube::I18n.t("ice_cube.integer.negative", ordinal: ord)
64+
(number >= 0) ? ord : IceCube::I18n.t("ice_cube.integer.negative", ordinal: ord)
6565
end
6666
end
6767

lib/ice_cube/flexible_hash.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ def delete(key)
2525

2626
def _match_key(key)
2727
return key if __getobj__.has_key? key
28-
if Symbol == key.class
28+
if key.instance_of?(Symbol)
2929
__getobj__.keys.detect { |k| return k if k == key.to_s }
30-
elsif String == key.class
30+
elsif key.instance_of?(String)
3131
__getobj__.keys.detect { |k| return k if k.to_s == key }
3232
end
3333
key

lib/ice_cube/input_alignment.rb

Lines changed: 6 additions & 6 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 = {}, &block)
11+
def verify(freq, options = {}, &)
1212
@rule.validations[:interval] or return
1313

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

@@ -28,12 +28,12 @@ def interval_validation
2828
end
2929

3030
def interval_value
31-
@interval_value ||= rule_part == :interval ? value : interval_validation.interval
31+
@interval_value ||= (rule_part == :interval) ? value : interval_validation.interval
3232
end
3333

3434
def fixed_validations
3535
@fixed_validations ||= @rule.validations.values.flatten.select { |v|
36-
interval_type = (v.type == :wday ? :day : v.type)
36+
interval_type = ((v.type == :wday) ? :day : v.type)
3737
v.class < Validations::FixedValue &&
3838
interval_type == rule.base_interval_validation.type
3939
}

lib/ice_cube/null_i18n.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module NullI18n
55
def self.t(key, options = {})
66
base = key.to_s.split(".").reduce(config) { |hash, current_key| hash[current_key] }
77

8-
base = base[options[:count] == 1 ? "one" : "other"] if options[:count]
8+
base = base[(options[:count] == 1) ? "one" : "other"] if options[:count]
99

1010
case base
1111
when Hash

lib/ice_cube/occurrence.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def to_s(format = nil)
9090
else
9191
t0, t1 = start_time.to_s, end_time.to_s
9292
end
93-
duration > 0 ? "#{t0} - #{t1}" : t0
93+
(duration > 0) ? "#{t0} - #{t1}" : t0
9494
end
9595

9696
def overnight?

lib/ice_cube/rules/weekly_rule.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def realign(step_time, start_time)
3535
time = TimeUtil::TimeWrapper.new(start_time)
3636
offset = wday_offset(step_time, start_time)
3737
time.add(:day, offset)
38-
super step_time, time.to_time
38+
super(step_time, time.to_time)
3939
end
4040

4141
# Calculate how many days to the first wday validation in the correct

lib/ice_cube/schedule.rb

Lines changed: 3 additions & 3 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(&block)
164-
enumerate_occurrences(start_time, &block).to_a
163+
def each_occurrence(&)
164+
enumerate_occurrences(start_time, &).to_a
165165
self
166166
end
167167

@@ -191,7 +191,7 @@ def previous_occurrences(num, from)
191191
from = TimeUtil.match_zone(from, start_time) or raise ArgumentError, "Time required, got #{from.inspect}"
192192
return [] if from <= start_time
193193
a = enumerate_occurrences(start_time, from - 1).to_a
194-
a.size > num ? a[-1 * num, a.size] : a
194+
(a.size > num) ? a[-1 * num, a.size] : a
195195
end
196196

197197
# The remaining occurrences (same requirements as all_occurrences)

0 commit comments

Comments
 (0)