ruby-fst 0.2.1-aarch64-linux → 0.3.0-aarch64-linux
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/CHANGELOG.md +29 -0
- data/README.md +10 -2
- data/lib/ruby_fst/3.2/ruby_fst.so +0 -0
- data/lib/ruby_fst/3.3/ruby_fst.so +0 -0
- data/lib/ruby_fst/3.4/ruby_fst.so +0 -0
- data/lib/ruby_fst/4.0/ruby_fst.so +0 -0
- data/lib/ruby_fst/version.rb +1 -1
- data/lib/ruby_fst.rb +23 -3
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 034ea29a738fb3ceef1b778baaf376d33aecdac2564d8c4242c516ae69f05ec5
|
|
4
|
+
data.tar.gz: 35028d3dc2ea7793fc20e49fea7b2d1fd2b74c0ce59c694db9a1e88ddf4a2c8b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d7d35a7071f794177638829ef9617bbae886b5abbbf50c33885cb2efdff71af64ae6a62fcf009a198bb159fb4e0546a18e787c4267515fa023148703bb7c9573
|
|
7
|
+
data.tar.gz: 2480a430f83c6b4dab66d1c2d81aaab4e9b08f7a11d6e015c3b78cc3066c55efa76528effcf7e4ba321a876c53fe45ba6498590aca8a3a2a1ee7070feb725922
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,35 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.3.0] — 2026-10-26
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
- I/O failures now raise `IOError` instead of `RuntimeError`, and Levenshtein queries too large to
|
|
13
|
+
compile raise `ArgumentError`. Other errors raise the new `RubyFst::Error`, a `RuntimeError`
|
|
14
|
+
subclass, so existing `rescue RuntimeError` for builder and format errors keeps working.
|
|
15
|
+
- `new` and `from_path` verify the FST checksum. Corrupt data now raises `RubyFst::Error`; before,
|
|
16
|
+
it could return wrong results or terminate the process. FSTs written by fst < 0.4 have no
|
|
17
|
+
checksum and still load unverified. `from_path_mmap` does not verify.
|
|
18
|
+
- Paths accept `Pathname`, and on Unix non-UTF-8 file names.
|
|
19
|
+
- `each` and `search_levenshtein` return an `Enumerator` when called without a block.
|
|
20
|
+
- In-memory FSTs report their size to Ruby's GC.
|
|
21
|
+
|
|
22
|
+
- `save` writes a temporary file and renames it into place, so readers never see a partial file.
|
|
23
|
+
Symlinks are followed and permissions kept, but the replacement is a new file: hard links to the
|
|
24
|
+
old one are broken and ownership becomes the saving user's. Where a rename can't work (a
|
|
25
|
+
non-regular target such as a FIFO, or an unwritable directory) it writes in place as before. A
|
|
26
|
+
crash mid-save can leave a `<path>.tmp-<pid>` file behind.
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
- Saving over a memory-mapped file no longer crashes the process with `SIGBUS` on Linux and macOS.
|
|
30
|
+
Windows can't replace a mapped file, so `save` raises `IOError` there.
|
|
31
|
+
|
|
32
|
+
## [0.2.2] — 2026-09-24
|
|
33
|
+
|
|
34
|
+
### Fixed
|
|
35
|
+
- Precompiled gems failed to load: the binaries ship under `lib/ruby_fst/<ruby minor>/`, but
|
|
36
|
+
the loader only looked for the source-build path. It now tries the versioned directory first.
|
|
37
|
+
|
|
9
38
|
## [0.2.1] — 2026-09-24
|
|
10
39
|
|
|
11
40
|
### Fixed
|
data/README.md
CHANGED
|
@@ -25,7 +25,7 @@ gem 'ruby-fst'
|
|
|
25
25
|
|
|
26
26
|
All FST keys are arbitrary byte strings (`Encoding::BINARY`). When a key is returned from the gem (e.g. via `each`, `get_le`, `range`) it always carries the `Encoding::BINARY` encoding — be careful when interpolating into UTF-8 strings or `puts`-ing keys that contain non-ASCII bytes.
|
|
27
27
|
|
|
28
|
-
Keys must be inserted into a builder in **strictly ascending lexicographic byte order**, with no duplicates. Out-of-order or duplicate inserts raise
|
|
28
|
+
Keys must be inserted into a builder in **strictly ascending lexicographic byte order**, with no duplicates. Out-of-order or duplicate inserts raise `RubyFst::Error`.
|
|
29
29
|
|
|
30
30
|
## Map
|
|
31
31
|
|
|
@@ -156,7 +156,15 @@ map = RubyFst::Map.from_path('/path/to/file.fst')
|
|
|
156
156
|
map = RubyFst::Map.from_path_mmap('/path/to/file.fst')
|
|
157
157
|
```
|
|
158
158
|
|
|
159
|
-
|
|
159
|
+
`new` and `from_path` verify the FST's checksum (FSTs written before fst 0.4 have none and load unverified) and raise `RubyFst::Error` on corrupt or invalid data. `from_path_mmap` skips the check so that opening a large file stays cheap, which means a corrupt file can return wrong results or terminate the process — only memory-map files you trust.
|
|
160
|
+
|
|
161
|
+
When using `from_path_mmap`, the file must remain unchanged on disk for the lifetime of the resulting `Map` or `Set` — modifying or truncating it in place causes undefined behavior. `save` writes to a temporary file beside the target and renames it into place, so on Linux and macOS saving over a mapped file is safe: the existing mapping keeps reading the old contents. Windows refuses to replace a file while it is mapped, so there `save` raises `IOError` instead.
|
|
162
|
+
|
|
163
|
+
## Errors
|
|
164
|
+
|
|
165
|
+
- `IOError` — a file couldn't be read, mapped, or written.
|
|
166
|
+
- `ArgumentError` — a Levenshtein query too large to build an automaton for.
|
|
167
|
+
- `RubyFst::Error` (a `RuntimeError` subclass) — invalid or corrupt FST data, out-of-order builder inserts, or a builder used after `finish`.
|
|
160
168
|
|
|
161
169
|
## Development
|
|
162
170
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/lib/ruby_fst/version.rb
CHANGED
data/lib/ruby_fst.rb
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative 'ruby_fst/version'
|
|
4
|
-
|
|
4
|
+
begin
|
|
5
|
+
require_relative "ruby_fst/#{RUBY_VERSION[/\A\d+\.\d+/]}/ruby_fst"
|
|
6
|
+
rescue LoadError
|
|
7
|
+
require_relative 'ruby_fst/ruby_fst'
|
|
8
|
+
end
|
|
5
9
|
|
|
6
10
|
module RubyFst
|
|
7
11
|
module RangeQuery
|
|
12
|
+
def each(&block)
|
|
13
|
+
return enum_for(:each) { size } unless block
|
|
14
|
+
|
|
15
|
+
_each(&block)
|
|
16
|
+
end
|
|
17
|
+
|
|
8
18
|
def range(ge: nil, le: nil, &block)
|
|
9
19
|
return enum_for(:range, ge:, le:) unless block
|
|
10
20
|
|
|
@@ -16,14 +26,22 @@ module RubyFst
|
|
|
16
26
|
|
|
17
27
|
_starts_with(prefix, &block)
|
|
18
28
|
end
|
|
29
|
+
|
|
30
|
+
def search_levenshtein(query, distance, &block)
|
|
31
|
+
return enum_for(:search_levenshtein, query, distance) unless block
|
|
32
|
+
|
|
33
|
+
_search_levenshtein(query, distance, &block)
|
|
34
|
+
end
|
|
19
35
|
end
|
|
20
36
|
|
|
21
37
|
class Map
|
|
22
38
|
include Enumerable
|
|
23
39
|
|
|
40
|
+
alias _each each
|
|
24
41
|
alias _range range
|
|
25
42
|
alias _starts_with starts_with
|
|
26
|
-
|
|
43
|
+
alias _search_levenshtein search_levenshtein
|
|
44
|
+
private :_each, :_range, :_starts_with, :_search_levenshtein
|
|
27
45
|
|
|
28
46
|
prepend RangeQuery
|
|
29
47
|
end
|
|
@@ -31,9 +49,11 @@ module RubyFst
|
|
|
31
49
|
class Set
|
|
32
50
|
include Enumerable
|
|
33
51
|
|
|
52
|
+
alias _each each
|
|
34
53
|
alias _range range
|
|
35
54
|
alias _starts_with starts_with
|
|
36
|
-
|
|
55
|
+
alias _search_levenshtein search_levenshtein
|
|
56
|
+
private :_each, :_range, :_starts_with, :_search_levenshtein
|
|
37
57
|
|
|
38
58
|
prepend RangeQuery
|
|
39
59
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby-fst
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: aarch64-linux
|
|
6
6
|
authors:
|
|
7
7
|
- Denis Sablic
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-10-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Finite state transducer backed ordered sets and maps via the Rust fst
|
|
14
14
|
crate by BurntSushi
|