Using RubyNext in gems without a runtime dependency
From https://github.com/ruby-next/ruby-next/issues/100#issuecomment-1282607086
So we'd run ruby-next nextify to create the files, and paste something like $LOAD_PATH.unshift "#{__dir__}/.rbnext" but wouldn't need any require 'ruby-next'.
The reason is the transpiled files would only be used on some Ruby implementations, and we wouldn't to add a dependency to the gem for all Ruby implementations.
This mostly already works with ruby-next nextify -V --rewrite=pattern-matching --no-refine ./lib, but would need documentation in https://github.com/ruby-next/ruby-next#integrating-into-a-gem-development
This mostly already works with ruby-next nextify -V --rewrite=pattern-matching --no-refine ./lib
And, I think, adding --single-version is required in this cases (so .rbnext contains the transpiled files for the minimum supported version, not for multiple versions in subfolders, .rbnext/2.7, .rbnext/3.0, etc.)
Right. Currently that command-line already behaves as --single-version even when not passing it.
Oh, right, that's because specifying rewriters explicitly implies having a single version: https://github.com/ruby-next/ruby-next/blob/cabf5829ee6939d23481ed74eb20809e2191eeac/lib/ruby-next/commands/nextify.rb#L211