spellkit 0.2.0 → 0.3.0
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 +4 -4
- data/README.md +7 -3
- data/ext/spellkit/Cargo.toml +1 -1
- data/ext/spellkit/src/lib.rs +9 -8
- data/lib/spellkit/version.rb +1 -1
- metadata +15 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a16cdfa3277c6161351b4b9f2ba35720dd78487f7e7b49f6c3cebc6a6a4d2d4b
|
|
4
|
+
data.tar.gz: 71ec217bee6087915e2fa2fec3229ba4fa1ee8b354c437acf68ef5abcef19b0f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 47903715b908a7d5e55837dc94edacf50f91399a74b2ec12174c22015657864624436cc59b5d9ec93de349d1dd17da45edda3f879a8622c320190568335d4f85
|
|
7
|
+
data.tar.gz: 0ef569d807b305ff9c3f1598e0c705ae72559aefd3efd644c90dc8f749db389d05861a698b39dd9ead5fe95652b5350e7519c25e7b17fc622422d91900cb43f9
|
data/README.md
CHANGED
|
@@ -684,9 +684,13 @@ bundle exec rake build
|
|
|
684
684
|
## Platform Support
|
|
685
685
|
|
|
686
686
|
Pre-built gems available for:
|
|
687
|
-
- macOS (
|
|
688
|
-
- Linux (
|
|
689
|
-
- Ruby 3.1, 3.2, 3.3
|
|
687
|
+
- macOS (arm64)
|
|
688
|
+
- Linux (x86_64, aarch64)
|
|
689
|
+
- Ruby 3.1, 3.2, 3.3, 3.4, 4.0
|
|
690
|
+
|
|
691
|
+
A pre-built gem carries one compiled extension per Ruby ABI, so installing under a Ruby
|
|
692
|
+
outside that list falls back to building from source and needs a Rust toolchain (>= 1.85).
|
|
693
|
+
Ruby 4.0 support arrived in 0.3.0; earlier versions cannot compile against it at all.
|
|
690
694
|
|
|
691
695
|
## Contributing
|
|
692
696
|
|
data/ext/spellkit/Cargo.toml
CHANGED
data/ext/spellkit/src/lib.rs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
mod symspell;
|
|
2
2
|
mod guards;
|
|
3
3
|
|
|
4
|
-
use magnus::{
|
|
4
|
+
use magnus::{function, method, prelude::*, Error, RArray, RHash, Ruby, Value, TryConvert};
|
|
5
5
|
use std::sync::{Arc, RwLock};
|
|
6
6
|
use symspell::SymSpell;
|
|
7
7
|
use guards::Guards;
|
|
@@ -264,10 +264,10 @@ impl Checker {
|
|
|
264
264
|
|
|
265
265
|
if let Some(ref symspell) = state.symspell {
|
|
266
266
|
let suggestions = symspell.suggestions(&word, max_suggestions);
|
|
267
|
-
let result =
|
|
267
|
+
let result = ruby.ary_new();
|
|
268
268
|
|
|
269
269
|
for suggestion in suggestions {
|
|
270
|
-
let hash =
|
|
270
|
+
let hash = ruby.hash_new();
|
|
271
271
|
hash.aset("term", suggestion.term)?;
|
|
272
272
|
hash.aset("distance", suggestion.distance)?;
|
|
273
273
|
hash.aset("freq", suggestion.frequency)?;
|
|
@@ -320,7 +320,7 @@ impl Checker {
|
|
|
320
320
|
return Err(Error::new(ruby.exception_runtime_error(), "Dictionary not loaded. Call load! first"));
|
|
321
321
|
}
|
|
322
322
|
|
|
323
|
-
let result =
|
|
323
|
+
let result = ruby.ary_new();
|
|
324
324
|
|
|
325
325
|
if let Some(ref symspell) = state.symspell {
|
|
326
326
|
for token in tokens.into_iter() {
|
|
@@ -336,8 +336,9 @@ impl Checker {
|
|
|
336
336
|
}
|
|
337
337
|
|
|
338
338
|
fn stats(&self) -> Result<RHash, Error> {
|
|
339
|
+
let ruby = Ruby::get().unwrap();
|
|
339
340
|
let state = self.state.read().unwrap();
|
|
340
|
-
let stats =
|
|
341
|
+
let stats = ruby.hash_new();
|
|
341
342
|
|
|
342
343
|
if !state.loaded {
|
|
343
344
|
stats.aset("loaded", false)?;
|
|
@@ -376,9 +377,9 @@ impl Checker {
|
|
|
376
377
|
}
|
|
377
378
|
|
|
378
379
|
#[magnus::init]
|
|
379
|
-
fn init(
|
|
380
|
-
let module = define_module("SpellKit")?;
|
|
381
|
-
let checker_class = module.define_class("Checker",
|
|
380
|
+
fn init(ruby: &Ruby) -> Result<(), Error> {
|
|
381
|
+
let module = ruby.define_module("SpellKit")?;
|
|
382
|
+
let checker_class = module.define_class("Checker", ruby.class_object())?;
|
|
382
383
|
|
|
383
384
|
checker_class.define_singleton_method("new", function!(Checker::new, 0))?;
|
|
384
385
|
checker_class.define_method("load!", method!(Checker::load_full, 1))?;
|
data/lib/spellkit/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spellkit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chris Petersen
|
|
@@ -121,6 +121,20 @@ dependencies:
|
|
|
121
121
|
- - ">="
|
|
122
122
|
- !ruby/object:Gem::Version
|
|
123
123
|
version: '0'
|
|
124
|
+
- !ruby/object:Gem::Dependency
|
|
125
|
+
name: benchmark
|
|
126
|
+
requirement: !ruby/object:Gem::Requirement
|
|
127
|
+
requirements:
|
|
128
|
+
- - ">="
|
|
129
|
+
- !ruby/object:Gem::Version
|
|
130
|
+
version: '0'
|
|
131
|
+
type: :development
|
|
132
|
+
prerelease: false
|
|
133
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
134
|
+
requirements:
|
|
135
|
+
- - ">="
|
|
136
|
+
- !ruby/object:Gem::Version
|
|
137
|
+
version: '0'
|
|
124
138
|
- !ruby/object:Gem::Dependency
|
|
125
139
|
name: benchmark-ips
|
|
126
140
|
requirement: !ruby/object:Gem::Requirement
|