ruby/lib/forwardable/forwardable.gemspec
Jean Boussier 14ff851185 [ruby/forwardable] Simpler and faster check for the delegation fastpath
Fix: https://github.com/ruby/forwardable/issues/35
[Bug #21708]

Trying to compile code to check if a method can use the delegation
fastpath is a bit wasteful and cause `RUPYOPT=-d` to be full of
misleading errors.

It's simpler and faster to use a simple regexp to do the same check.

https://github.com/ruby/forwardable/commit/de1fbd182e
2025-12-10 07:05:06 +00:00

27 lines
987 B
Ruby

# frozen_string_literal: true
name = File.basename(__FILE__, ".gemspec")
version = ["lib", Array.new(name.count("-")+1, "..").join("/")].find do |dir|
break File.foreach(File.join(__dir__, dir, "#{name.tr('-', '/')}.rb")) do |line|
/^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1
end rescue nil
end
Gem::Specification.new do |spec|
spec.name = name
spec.version = version
spec.authors = ["Keiju ISHITSUKA"]
spec.email = ["keiju@ruby-lang.org"]
spec.summary = %q{Provides delegation of specified methods to a designated object.}
spec.description = %q{Provides delegation of specified methods to a designated object.}
spec.homepage = "https://github.com/ruby/forwardable"
spec.licenses = ["Ruby", "BSD-2-Clause"]
spec.required_ruby_version = '>= 2.4.0'
spec.files = ["forwardable.gemspec", "lib/forwardable.rb"]
spec.bindir = "exe"
spec.executables = []
spec.require_paths = ["lib"]
end