tracklib 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +5 -18
- data/lib/tracklib/version.rb +1 -1
- data/src/lib.rs +30 -36
- data/tracklib.gemspec +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51bc0c50cee5c08e2a0ab5a48e5a9d4cd00f4db1
|
4
|
+
data.tar.gz: 496ec85199832aa9cd953d0ef621a5508d03bef0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ebff64b608756ac55476fc9661249419e746539753e5bcde585f546b08e9a665bb492118b1b2d882670769456b23d80b719952f67b3efcf591b7c49950bcf81
|
7
|
+
data.tar.gz: e0cdf446ca0fc4f386f186bb4655509a58a4d43e5e41ca9e43f2c8183afdd1d962eeb457bbb5f88dcfa9dcab7165bed896b85e67ed22fb0de7489890bc9da173
|
data/Rakefile
CHANGED
@@ -1,29 +1,16 @@
|
|
1
|
+
# coding: utf-8
|
1
2
|
require "rbconfig"
|
2
3
|
require "bundler/gem_tasks"
|
3
4
|
require "rake/testtask"
|
4
5
|
require "thermite/tasks"
|
6
|
+
require 'rspec/core/rake_task'
|
5
7
|
|
6
8
|
thermite = Thermite::Tasks.new
|
9
|
+
RSpec::Core::RakeTask.new(:spec)
|
7
10
|
|
8
|
-
desc '
|
9
|
-
task :
|
10
|
-
case RbConfig::CONFIG['host_os']
|
11
|
-
when /darwin|mac os/
|
12
|
-
sh 'NO_LINK_RUTIE=y cargo rustc --release -- -C link-args=-Wl,-undefined,dynamic_lookup'
|
13
|
-
else
|
14
|
-
sh 'NO_LINK_RUTIE=y cargo build --release'
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
desc 'bundle install'
|
19
|
-
task :bundle_install do
|
20
|
-
sh 'bundle install'
|
21
|
-
end
|
11
|
+
desc 'Run Rust & Ruby testsuites'
|
12
|
+
task test: ['thermite:build', 'thermite:test', 'spec'] do
|
22
13
|
|
23
|
-
Rake::TestTask.new(test: [:bundle_install, :build_lib]) do |t|
|
24
|
-
t.libs << "test"
|
25
|
-
t.libs << "lib"
|
26
|
-
t.test_files = FileList["test/**/*_test.rb"]
|
27
14
|
end
|
28
15
|
|
29
16
|
task :default => :test
|
data/lib/tracklib/version.rb
CHANGED
data/src/lib.rs
CHANGED
@@ -85,6 +85,30 @@ fn convert_config(config: Hash) -> HashMap<String, String> {
|
|
85
85
|
hm
|
86
86
|
}
|
87
87
|
|
88
|
+
fn is_empty_string(v: &AnyObject) -> bool {
|
89
|
+
match v.try_convert_to::<RString>() {
|
90
|
+
Ok(s) => s.to_str().is_empty(),
|
91
|
+
Err(_) => false
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
fn is_empty_array(v: &AnyObject) -> bool {
|
96
|
+
match v.try_convert_to::<Array>() {
|
97
|
+
Ok(a) => a.length() == 0,
|
98
|
+
Err(_) => false
|
99
|
+
}
|
100
|
+
}
|
101
|
+
|
102
|
+
fn is_number_too_large(v: &AnyObject) -> bool {
|
103
|
+
match v.try_convert_to::<Integer>() {
|
104
|
+
Ok(i) => i.to_i64().abs() > 2i64.pow(48),
|
105
|
+
Err(_) => match v.try_convert_to::<Float>() {
|
106
|
+
Ok(f) => f.to_f64().abs() > 2f64.powi(48),
|
107
|
+
Err(_) => false
|
108
|
+
}
|
109
|
+
}
|
110
|
+
}
|
111
|
+
|
88
112
|
fn add_points(points: Array, mut callback: impl FnMut(usize, &str, AnyObject)) {
|
89
113
|
for (i, maybe_point) in points.into_iter().enumerate() {
|
90
114
|
let point = maybe_point
|
@@ -98,43 +122,13 @@ fn add_points(points: Array, mut callback: impl FnMut(usize, &str, AnyObject)) {
|
|
98
122
|
.map_err(|e| VM::raise_ex(e))
|
99
123
|
.unwrap();
|
100
124
|
let name = field_name_obj.to_str();
|
101
|
-
let mut store_field = true;
|
102
|
-
|
103
|
-
if v.is_nil() {
|
104
|
-
store_field = false;
|
105
|
-
}
|
106
|
-
|
107
|
-
if name.is_empty() {
|
108
|
-
store_field = false;
|
109
|
-
}
|
110
|
-
|
111
|
-
match v.try_convert_to::<RString>() {
|
112
|
-
Ok(s) => if s.to_str().is_empty() {
|
113
|
-
store_field = false;
|
114
|
-
}
|
115
|
-
Err(_) => {}
|
116
|
-
}
|
117
|
-
|
118
|
-
match v.try_convert_to::<Array>() {
|
119
|
-
Ok(a) => if a.length() == 0 {
|
120
|
-
store_field = false;
|
121
|
-
}
|
122
|
-
Err(_) => {}
|
123
|
-
}
|
124
|
-
|
125
|
-
match v.try_convert_to::<Integer>() {
|
126
|
-
Ok(i) => if i.to_i64().abs() > 2i64.pow(48) {
|
127
|
-
store_field = false;
|
128
|
-
}
|
129
|
-
Err(_) => match v.try_convert_to::<Float>() {
|
130
|
-
Ok(f) => if f.to_f64().abs() > 2f64.powi(48) {
|
131
|
-
store_field = false;
|
132
|
-
}
|
133
|
-
Err(_) => {}
|
134
|
-
}
|
135
|
-
}
|
136
125
|
|
137
|
-
if
|
126
|
+
if !v.is_nil()
|
127
|
+
&& !name.is_empty()
|
128
|
+
&& !is_empty_string(&v)
|
129
|
+
&& !is_empty_array(&v)
|
130
|
+
&& !is_number_too_large(&v)
|
131
|
+
{
|
138
132
|
callback(i, name, v);
|
139
133
|
}
|
140
134
|
});
|
data/tracklib.gemspec
CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.require_paths = ["lib"]
|
26
26
|
spec.extensions = ["ext/Rakefile"]
|
27
27
|
|
28
|
-
spec.add_development_dependency "
|
28
|
+
spec.add_development_dependency "rspec"
|
29
29
|
|
30
30
|
spec.add_runtime_dependency "rake", "~> 12.3"
|
31
31
|
spec.add_runtime_dependency 'thermite', '~> 0.13'
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tracklib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Larkin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: rspec
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|