Skip to content

Commit b75aa89

Browse files
committed
🐛 Fix loading gem specification externally
1 parent b14bb9b commit b75aa89

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

memo_wise.gemspec

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@ Gem::Specification.new do |spec|
1414
# because the latter only loads a file once, and so by undefining the
1515
# `VERSION` constant we can make it difficult to access that value again
1616
# later. For more context, see: https://github.com/panorama-ed/memo_wise/pull/370#issuecomment-2560268423
17-
spec.version = Module.new.tap do |mod|
18-
# NOTE: We fully qualify `Kernel` here because Rubygems defines its own
19-
# `load` method, which is used by default when this code is executed by
20-
# `gem build memo_wise.gemspec`. That `load` method does not support the
21-
# optional "wrap" parameter we pass through as `mod`. For more context, see:
22-
# https://github.com/simplecov-ruby/simplecov/issues/557#issuecomment-2630782358
23-
Kernel.load("lib/memo_wise/version.rb", mod)
24-
end::MemoWise::VERSION
17+
# NOTE: We fully qualify `Kernel` here because Rubygems defines its own
18+
# `load` method, which is used by default when this code is executed by
19+
# `gem build memo_wise.gemspec`. That `load` method does not support the
20+
# optional "wrap" parameter we pass through as `mod`. For more context, see:
21+
# https://github.com/simplecov-ruby/simplecov/issues/557#issuecomment-2630782358
22+
spec.version = Module.new.tap { |mod| Kernel.load("#{__dir__}/lib/memo_wise/version.rb", mod) }::MemoWise::VERSION
2523
spec.summary = "The wise choice for Ruby memoization"
2624
spec.homepage = "https://github.com/panorama-ed/memo_wise"
2725
spec.license = "MIT"

0 commit comments

Comments
 (0)