ruby_sscanf 0.2.4 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CODE_OF_CONDUCT.md +49 -0
- data/README.md +56 -17
- data/lib/ruby_sscanf/version.rb +1 -1
- data/rakefile.rb +1 -1
- data/ruby_sscanf.gemspec +6 -7
- data/tests/scan_tests.rb +0 -5
- metadata +21 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 05d51301d8d800c26586b31a134f09e7c3a632e757b123dc4d80d86e734eec84
|
4
|
+
data.tar.gz: 0323f09c4986467708577f7aeea0c35f41e7d2f0bae225b951f2ce0bab656695
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff8d1bdf4ef2c32424dc28a4fac09ad186cfd2fdce6ce7932e8bb64eed7ef71dfa49ddc26747824bdf998fce6b3ed26e7d5c63b484fc835e10df44dd4e1728b6
|
7
|
+
data.tar.gz: cd1d3e1e43cc2d0b04499493c869454997c3a5fe75a6e5d81f542566b21764066e38246866dc2680a0b3cba4fbd4c21de5695bb87a1c5a72a603fd51e7c8f5ed
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at peter.c.camilleri@gmail.com. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/README.md
CHANGED
@@ -105,7 +105,7 @@ Limitation: zero width (positive or negative) look behind assertions (?<= )
|
|
105
105
|
and (?<! ) are not supported at this time.
|
106
106
|
|
107
107
|
#### Examples
|
108
|
-
Here are a few
|
108
|
+
Here are a few examples of the sscanf method in action.
|
109
109
|
|
110
110
|
```ruby
|
111
111
|
"12 34 -56".sscanf "%d %2d %4d"
|
@@ -173,6 +173,8 @@ is not parsed. It is possible to retrieve this text using the following:
|
|
173
173
|
```ruby
|
174
174
|
String.sscanf_unparsed
|
175
175
|
```
|
176
|
+
Note: Since the ruby_sscanf gem is designed to be thread safe, each thread has
|
177
|
+
its own copy of the unparsed text.
|
176
178
|
|
177
179
|
## Demo
|
178
180
|
|
@@ -187,25 +189,50 @@ I ran a test just to make sure that ruby_sscanf was not terribly
|
|
187
189
|
under-performant when compared to the ruby standard library version. I was
|
188
190
|
pleased to see that in fact ruby_sscanf was faster. Here are the results:
|
189
191
|
|
190
|
-
Warming up --------------------------------------
|
191
|
-
Scan strings with ruby_sscanf
|
192
|
-
1.734k i/100ms
|
193
|
-
Scan strings with scanf
|
194
|
-
309.000 i/100ms
|
195
|
-
Calculating -------------------------------------
|
196
|
-
Scan strings with ruby_sscanf
|
197
|
-
17.926k (± 0.6%) i/s - 90.168k
|
198
|
-
Scan strings with scanf
|
199
|
-
3.123k (± 0.6%) i/s - 15.759k
|
200
|
-
|
201
|
-
Comparison:
|
202
|
-
Scan strings with ruby_sscanf: 17925.7 i/s
|
203
|
-
Scan strings with scanf: 3123.0 i/s - 5.74x slower
|
204
|
-
|
205
192
|
This benchmark test was run under:
|
206
193
|
* ruby 2.1.6p336 (2015-04-13 revision 50298) [i386-mingw32]
|
207
194
|
* format_engine version = 0.7.2
|
208
195
|
|
196
|
+
```
|
197
|
+
Warming up --------------------------------------
|
198
|
+
Scan strings with ruby_sscanf
|
199
|
+
1.734k i/100ms
|
200
|
+
Scan strings with scanf
|
201
|
+
309.000 i/100ms
|
202
|
+
Calculating -------------------------------------
|
203
|
+
Scan strings with ruby_sscanf
|
204
|
+
17.926k (± 0.6%) i/s - 90.168k
|
205
|
+
Scan strings with scanf
|
206
|
+
3.123k (± 0.6%) i/s - 15.759k
|
207
|
+
|
208
|
+
Comparison:
|
209
|
+
Scan strings with ruby_sscanf: 17925.7 i/s
|
210
|
+
Scan strings with scanf: 3123.0 i/s - 5.74x slower
|
211
|
+
```
|
212
|
+
|
213
|
+
This benchmark test was run under:
|
214
|
+
* ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32]
|
215
|
+
* format_engine version = 0.7.7
|
216
|
+
|
217
|
+
```
|
218
|
+
Warming up --------------------------------------
|
219
|
+
Scan strings with ruby_sscanf
|
220
|
+
1.632k i/100ms
|
221
|
+
Scan strings with scanf
|
222
|
+
288.000 i/100ms
|
223
|
+
Calculating -------------------------------------
|
224
|
+
Scan strings with ruby_sscanf
|
225
|
+
17.402k (± 0.6%) i/s - 88.128k in 5.064426s
|
226
|
+
Scan strings with scanf
|
227
|
+
2.908k (± 0.3%) i/s - 14.688k in 5.050854s
|
228
|
+
|
229
|
+
Comparison:
|
230
|
+
Scan strings with ruby_sscanf: 17402.1 i/s
|
231
|
+
Scan strings with scanf: 2908.1 i/s - 5.98x slower
|
232
|
+
```
|
233
|
+
|
234
|
+
|
235
|
+
|
209
236
|
## Contributing
|
210
237
|
|
211
238
|
#### Plan A
|
@@ -218,6 +245,18 @@ This benchmark test was run under:
|
|
218
245
|
|
219
246
|
#### Plan B
|
220
247
|
|
221
|
-
Go to the GitHub repository and raise an
|
248
|
+
Go to the GitHub repository and raise an
|
249
|
+
[issue](https://github.com/PeterCamilleri/ruby_sscanf/issues)
|
250
|
+
calling attention to some
|
222
251
|
aspect that could use some TLC or a suggestion or an idea.
|
223
252
|
|
253
|
+
## License
|
254
|
+
|
255
|
+
The gem is available as open source under the terms of the
|
256
|
+
[MIT License](./LICENSE.txt).
|
257
|
+
|
258
|
+
## Code of Conduct
|
259
|
+
|
260
|
+
Everyone interacting in the fully_freeze project’s codebases, issue trackers,
|
261
|
+
chat rooms and mailing lists is expected to follow the
|
262
|
+
[code of conduct](./CODE_OF_CONDUCT.md).
|
data/lib/ruby_sscanf/version.rb
CHANGED
data/rakefile.rb
CHANGED
data/ruby_sscanf.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
|
12
12
|
spec.summary = "A string parser."
|
13
13
|
spec.description = "A formatted string data parser for Ruby"
|
14
|
-
spec.homepage = "
|
14
|
+
spec.homepage = "https://github.com/PeterCamilleri/ruby_sscanf"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
17
|
raw_list = `git ls-files`.split($/)
|
@@ -22,12 +22,11 @@ Gem::Specification.new do |spec|
|
|
22
22
|
|
23
23
|
spec.required_ruby_version = '>= 1.9.3'
|
24
24
|
|
25
|
-
spec.add_runtime_dependency "format_engine", "
|
25
|
+
spec.add_runtime_dependency "format_engine", "~> 0.7.2"
|
26
26
|
|
27
|
-
spec.add_development_dependency "
|
28
|
-
spec.add_development_dependency "
|
29
|
-
spec.add_development_dependency 'minitest', "~> 5.
|
30
|
-
spec.add_development_dependency '
|
31
|
-
spec.add_development_dependency 'rdoc', "~> 4.0.1"
|
27
|
+
spec.add_development_dependency "rake", ">= 12.3.3"
|
28
|
+
spec.add_development_dependency "bundler", ">= 2.1.0"
|
29
|
+
spec.add_development_dependency 'minitest', "~> 5.7"
|
30
|
+
spec.add_development_dependency 'rdoc', "~> 5.0"
|
32
31
|
|
33
32
|
end
|
data/tests/scan_tests.rb
CHANGED
@@ -1,15 +1,10 @@
|
|
1
1
|
require_relative '../lib/ruby_sscanf'
|
2
2
|
gem 'minitest'
|
3
3
|
require 'minitest/autorun'
|
4
|
-
require 'minitest_visible'
|
5
|
-
|
6
4
|
|
7
5
|
# Test the internals of the parser engine. This is not the normal interface.
|
8
6
|
class ScanTester < Minitest::Test
|
9
7
|
|
10
|
-
#Track mini-test progress.
|
11
|
-
include MinitestVisible
|
12
|
-
|
13
8
|
def test_that_it_can_scan
|
14
9
|
result = "12 34 -56".sscanf "%d %2d %4d"
|
15
10
|
assert_equal([12, 34, -56] , result)
|
metadata
CHANGED
@@ -1,99 +1,85 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_sscanf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Camilleri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: format_engine
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.7.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.7.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 12.3.3
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 12.3.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 2.1.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 2.1.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: minitest
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 5.
|
61
|
+
version: '5.7'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 5.
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: minitest_visible
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 0.1.1
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 0.1.1
|
68
|
+
version: '5.7'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: rdoc
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
86
72
|
requirements:
|
87
73
|
- - "~>"
|
88
74
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
75
|
+
version: '5.0'
|
90
76
|
type: :development
|
91
77
|
prerelease: false
|
92
78
|
version_requirements: !ruby/object:Gem::Requirement
|
93
79
|
requirements:
|
94
80
|
- - "~>"
|
95
81
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
82
|
+
version: '5.0'
|
97
83
|
description: A formatted string data parser for Ruby
|
98
84
|
email:
|
99
85
|
- peter.c.camilleri@gmail.com
|
@@ -102,6 +88,7 @@ extensions: []
|
|
102
88
|
extra_rdoc_files: []
|
103
89
|
files:
|
104
90
|
- ".gitignore"
|
91
|
+
- CODE_OF_CONDUCT.md
|
105
92
|
- Gemfile
|
106
93
|
- LICENSE.txt
|
107
94
|
- README.md
|
@@ -113,7 +100,7 @@ files:
|
|
113
100
|
- rakefile.rb
|
114
101
|
- ruby_sscanf.gemspec
|
115
102
|
- tests/scan_tests.rb
|
116
|
-
homepage:
|
103
|
+
homepage: https://github.com/PeterCamilleri/ruby_sscanf
|
117
104
|
licenses:
|
118
105
|
- MIT
|
119
106
|
metadata: {}
|
@@ -132,10 +119,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
119
|
- !ruby/object:Gem::Version
|
133
120
|
version: '0'
|
134
121
|
requirements: []
|
135
|
-
|
136
|
-
rubygems_version: 2.2.2
|
122
|
+
rubygems_version: 3.2.17
|
137
123
|
signing_key:
|
138
124
|
specification_version: 4
|
139
125
|
summary: A string parser.
|
140
126
|
test_files: []
|
141
|
-
has_rdoc:
|