librtree 1.0.1 → 1.0.2
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 +8 -0
- data/README.md +1 -0
- data/lib/rtree.rb +31 -20
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c35526142564e94d93f091e405467f2ee2df3d294b1a4b8e3a87db66f1229043
|
4
|
+
data.tar.gz: dffb928767c821a14460f21d06fc1c90e41a7a17a94a8e700fac0c409d65ca59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0447a6e59546922ed8d227e0f3589aae7771243c4e16c24ae46cde5075dae4b1f7be2b1a8526d58adc6c3db379719201fcf370f1251e82773f488046ab66caff
|
7
|
+
data.tar.gz: 8ed4fd4e3982a4bfbffac9a53f92ae6dfd497ac4e684110d72591e7ec500a4ee2629a5b3a17dad5cc404383eb7aaccf333d7d15a8aeaa943d858a3e973a35d13
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
Changelog
|
2
2
|
---------
|
3
3
|
|
4
|
+
### 1.0.2, pending
|
5
|
+
|
6
|
+
- The `#serialise` method raises if the read from pipe returns
|
7
|
+
nil (which it might), so the method (and other methods which
|
8
|
+
call it to serialise) now return `String` or raise
|
9
|
+
- Added RBS static type signatures and infrastructure for static
|
10
|
+
type checking with **steep**
|
11
|
+
|
4
12
|
### 1.0.1, 16-03-2023
|
5
13
|
|
6
14
|
- Update to 1.1.4 of embedded `librtree`
|
data/README.md
CHANGED
data/lib/rtree.rb
CHANGED
@@ -71,6 +71,10 @@ class RTree < RTreeBase
|
|
71
71
|
|
72
72
|
# @!visibility private
|
73
73
|
#
|
74
|
+
# The call to exit! here has a true argument, indicationg success,
|
75
|
+
# but the value is ignored, so could be omitted; but the sigature
|
76
|
+
# for exit! is incorrect: https://github.com/ruby/rbs/issues/1298
|
77
|
+
#
|
74
78
|
def deserialise(string, encoding)
|
75
79
|
raise TypeError unless string.is_a? String
|
76
80
|
rd, wr = IO.pipe(encoding)
|
@@ -89,7 +93,7 @@ class RTree < RTreeBase
|
|
89
93
|
wr.write(string)
|
90
94
|
ensure
|
91
95
|
wr.close
|
92
|
-
exit!
|
96
|
+
exit! true
|
93
97
|
end
|
94
98
|
end
|
95
99
|
result
|
@@ -97,13 +101,15 @@ class RTree < RTreeBase
|
|
97
101
|
|
98
102
|
# @!visibility private
|
99
103
|
#
|
104
|
+
# See note above on argument to exit!
|
105
|
+
#
|
100
106
|
def serialise(encoding)
|
101
107
|
rd, wr = IO.pipe(encoding)
|
102
108
|
if fork then
|
103
109
|
wr.close
|
104
110
|
unset_nonblock(rd)
|
105
111
|
begin
|
106
|
-
result = rd.read
|
112
|
+
result = rd.read || raise(IOError, 'reading from pipe')
|
107
113
|
ensure
|
108
114
|
rd.close
|
109
115
|
Process.wait
|
@@ -114,7 +120,7 @@ class RTree < RTreeBase
|
|
114
120
|
yield(wr)
|
115
121
|
ensure
|
116
122
|
wr.close
|
117
|
-
exit!
|
123
|
+
exit! true
|
118
124
|
end
|
119
125
|
end
|
120
126
|
result
|
@@ -233,19 +239,12 @@ class RTree < RTreeBase
|
|
233
239
|
# https://stackoverflow.com/questions/68122256/ It's still not
|
234
240
|
# clear to me why this qualification is needed, but that's a
|
235
241
|
# problem with my understanding of the Ruby Eigenclass, it is
|
236
|
-
# the expected behaviour
|
242
|
+
# the expected behaviour. Note that self.const_get(:FOO) is
|
243
|
+
# the same as self::FOO, but the latter gives a spurious
|
244
|
+
# type-warning from steep
|
237
245
|
#
|
238
246
|
def split_flag(split)
|
239
|
-
|
240
|
-
when :quadratic
|
241
|
-
self::SPLIT_QUADRATIC
|
242
|
-
when :linear
|
243
|
-
self::SPLIT_LINEAR
|
244
|
-
when :greene
|
245
|
-
self::SPLIT_GREENE
|
246
|
-
else
|
247
|
-
raise ArgumentError, "bad split value: #{split}"
|
248
|
-
end
|
247
|
+
self.const_get(split_symbol(split))
|
249
248
|
end
|
250
249
|
|
251
250
|
# @!visibility private
|
@@ -256,10 +255,22 @@ class RTree < RTreeBase
|
|
256
255
|
|
257
256
|
private
|
258
257
|
|
259
|
-
def deserialise(
|
260
|
-
RTree::IOUtil.deserialise(
|
258
|
+
def deserialise(string, encoding, &block)
|
259
|
+
RTree::IOUtil.deserialise(string, encoding, &block)
|
261
260
|
end
|
262
261
|
|
262
|
+
def split_symbol(split)
|
263
|
+
case split
|
264
|
+
when :quadratic
|
265
|
+
:SPLIT_QUADRATIC
|
266
|
+
when :linear
|
267
|
+
:SPLIT_LINEAR
|
268
|
+
when :greene
|
269
|
+
:SPLIT_GREENE
|
270
|
+
else
|
271
|
+
raise ArgumentError, "bad split value: #{split}"
|
272
|
+
end
|
273
|
+
end
|
263
274
|
end
|
264
275
|
|
265
276
|
# Initialize a new (empty) RTree
|
@@ -512,8 +523,8 @@ class RTree < RTreeBase
|
|
512
523
|
node_page_flag | split_flag
|
513
524
|
end
|
514
525
|
|
515
|
-
def serialise(
|
516
|
-
RTree::IOUtil.serialise(
|
526
|
+
def serialise(encoding, &block)
|
527
|
+
RTree::IOUtil.serialise(encoding, &block)
|
517
528
|
end
|
518
529
|
|
519
530
|
end
|
@@ -576,8 +587,8 @@ class RTree::Style < RTreeStyleBase
|
|
576
587
|
|
577
588
|
private
|
578
589
|
|
579
|
-
def deserialise(
|
580
|
-
RTree::IOUtil.deserialise(
|
590
|
+
def deserialise(string, encoding, &block)
|
591
|
+
RTree::IOUtil.deserialise(string, encoding, &block)
|
581
592
|
end
|
582
593
|
|
583
594
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: librtree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- J.J. Green
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '1.1'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: steep
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '1.3'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '1.3'
|
111
125
|
description: |
|
112
126
|
A Ruby extension implementing the R-tree spatial-index of
|
113
127
|
Guttman-Green.
|