fast_regexp 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3512de3c64b392ae48a21422dc3e61423af58ddd4c8141e952a23c80799c2261
4
- data.tar.gz: cd09cfa3f3299812e19bc043da29f814c340342af4434981b4a47a9cbb7eab53
3
+ metadata.gz: b7e4b114057d201c62b2d8ec4405b3d2554c1cebf1399433d275e111b93864dd
4
+ data.tar.gz: da33511a662b556bcd9d085d0d3a52e2a138120b040a79b37015970486630ee5
5
5
  SHA512:
6
- metadata.gz: e83cb56946505a54ce6511b0755ecfea0838268f79b51daf26f081490130f4db8049e561d37d136e1666536b10b24b555e7e005889e0d19fba6adca01b3bcc2e
7
- data.tar.gz: 5f10f02b3fa5accab0732be061bca6c1ea0d5739c72dfa52485cd7306685792d129ba14e0e881a3aa27563347428dc367a725b829a9d493c0cdb9d92dc0f21cd
6
+ metadata.gz: 6417817f643dd1f81979e02f75b5c211c2921e87fa448fdf33c2a7da4c44980ebe6e53f9a91feb18e494e2feafbbfb03d004d3c97e51a91e3de182d0b09132a1
7
+ data.tar.gz: 6ad069ffca51038fe5f74a6ad8496a672c25c8044e76cb084dd965a8cd380beaebba99908460431e41d223f96ac9168d0f02d6fca2e05f3d3fcf3c5661e8b1e2
data/README.md CHANGED
@@ -9,8 +9,6 @@ You get rust/regex's speed on the common path, and a single uniform API (`Fast::
9
9
 
10
10
  ## Installation
11
11
 
12
- Install [Rust](https://www.rust-lang.org/) via [rustup](https://rustup.rs/) or in any other way.
13
-
14
12
  Add as a dependency:
15
13
 
16
14
  ```ruby
@@ -21,6 +19,14 @@ gem "fast_regexp"
21
19
  gem install fast_regexp
22
20
  ```
23
21
 
22
+ Precompiled native gems are published for **arm64-darwin**, **x86_64-linux**,
23
+ and **aarch64-linux** against Ruby **3.3**, **3.4**, and **4.0** — no Rust
24
+ toolchain required on those platforms.
25
+
26
+ On any other platform/Ruby combo, Bundler/RubyGems falls back to the source
27
+ gem and compiles the extension at install time. That path needs
28
+ [Rust](https://www.rust-lang.org/) (install via [rustup](https://rustup.rs/)).
29
+
24
30
  Include in your code:
25
31
 
26
32
  ```ruby
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Fast
4
4
  class Regexp
5
- VERSION = "0.6.0"
5
+ VERSION = "0.6.1"
6
6
  end
7
7
  end
data/lib/fast_regexp.rb CHANGED
@@ -10,12 +10,23 @@ module Fast
10
10
  # (lookaround, backreferences, possessive quantifiers, etc.) we fall back
11
11
  # to `::Regexp` so consumers don't have to juggle two libraries.
12
12
  class Regexp
13
+ NATIVE_EXTENSIONS = %w[.bundle .so .rb].freeze
14
+
15
+ # Precompiled native gems ship per-ABI subdirs (`fast_regexp/4.0/...`),
16
+ # the source-gem `rake compile` build lands flat (`fast_regexp/...`).
17
+ # Pick whichever exists for the current Ruby ABI, with the per-ABI path
18
+ # winning when both are present.
19
+ def self.locate_native(base, ruby_version: RUBY_VERSION)
20
+ abi = ruby_version[/\d+\.\d+/]
21
+ candidates = [File.join(base, abi, "fast_regexp"), File.join(base, "fast_regexp")]
22
+ candidates.find { |stem| NATIVE_EXTENSIONS.any? { |ext| File.exist?(stem + ext) } }
23
+ end
13
24
  end
14
25
  end
15
26
 
16
- # Load the native extension AFTER the Fast::Regexp class shell exists — the
17
- # Rust init() looks up Fast::Regexp and registers Native under it.
18
- require_relative "fast_regexp/fast_regexp"
27
+ native = Fast::Regexp.locate_native(File.expand_path("fast_regexp", __dir__))
28
+ raise LoadError, "could not locate fast_regexp native extension" unless native
29
+ require native
19
30
 
20
31
  module Fast
21
32
  class Regexp
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fast_regexp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Jacobs