Skip to content

Commit 21cda6c

Browse files
committed
🎨 Address REEK list issues
1 parent b741245 commit 21cda6c

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

REEK

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1 @@
1-
spec/helpers/faux.rb -- 1 warning:
2-
[14, 15]:DuplicateMethodCall: VersionGem::Faux#actual_minor_version? calls 'RUBY_VER.segments' 2 times [https://github.com/troessner/reek/blob/v6.5.0/docs/Duplicate-Method-Call.md]
3-
lib/version_gem/epoch.rb -- 1 warning:
4-
[21]:IrresponsibleModule: VersionGem::Epoch::OverloadApiForEpoch has no descriptive comment [https://github.com/troessner/reek/blob/v6.5.0/docs/Irresponsible-Module.md]
5-
lib/version_gem/error.rb -- 1 warning:
6-
[4]:IrresponsibleModule: VersionGem::Error has no descriptive comment [https://github.com/troessner/reek/blob/v6.5.0/docs/Irresponsible-Module.md]
7-
lib/version_gem/ruby.rb -- 1 warning:
8-
[14, 15]:DuplicateMethodCall: VersionGem::Ruby#actual_minor_version? calls 'RUBY_VER.segments' 2 times [https://github.com/troessner/reek/blob/v6.5.0/docs/Duplicate-Method-Call.md]
9-
4 total warnings
1+
0 total warnings

lib/version_gem/ruby.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ def gte_minimum_version?(version, engine = "ruby")
1313

1414
# Check if the current Ruby version (MAJOR.MINOR) is equal to the given version
1515
def actual_minor_version?(major, minor, engine = "ruby")
16-
major.to_i == RUBY_VER.segments[0] &&
17-
minor.to_i == RUBY_VER.segments[1] &&
16+
segs = RUBY_VER.segments
17+
major.to_i == segs[0] &&
18+
minor.to_i == segs[1] &&
1819
::RUBY_ENGINE == engine
1920
end
2021
module_function :actual_minor_version?

spec/helpers/faux.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ def gte_minimum_version?(version, engine = "ruby")
1111
module_function :gte_minimum_version?
1212

1313
def actual_minor_version?(major, minor, engine = "ruby")
14-
major.to_i == RUBY_VER.segments[0] &&
15-
minor.to_i == RUBY_VER.segments[1] &&
14+
segs = RUBY_VER.segments
15+
major.to_i == segs[0] &&
16+
minor.to_i == segs[1] &&
1617
::RUBY_ENGINE == engine
1718
end
1819
module_function :actual_minor_version?

0 commit comments

Comments
 (0)