ruby_sscanf 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +19 -9
- data/lib/ruby_sscanf/version.rb +1 -1
- data/ruby_sscanf.gemspec +1 -1
- data/tests/scan_tests.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2bc480e9779f68f86b3e1fc6c3037c82f9faf0b8
|
4
|
+
data.tar.gz: fb6dd5f80869cdcbadaeb9ab8c277f3983b60cef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ddc5dc86fbfb694334448efc479a5084294094204be68cc8bbf7dc7c08f363606213d53668f9ab1b9ab62ade320d7f8e4ac10ef28df6d6cc18764b3c566ecea
|
7
|
+
data.tar.gz: 5d6af7a4a181a41e6ba9251b500553beed42e251e9686b9117475ee6fd597338998e648f242bd98cc6ef48e19f63538b7d01e23deb31d10a7da64eaa5557f9f0
|
data/README.md
CHANGED
@@ -4,6 +4,13 @@ The ruby_sscanf gem monkey patches the String class to support the sscanf
|
|
4
4
|
instance method. This method is modeled after the POSIX "C" standard sscanf
|
5
5
|
but with alterations and omissions to suit the Ruby programming language.
|
6
6
|
|
7
|
+
It is noteworthy that this gem never was intended to be 100% compatible with
|
8
|
+
the built in scanf library. Some differences are:
|
9
|
+
* It deals only with strings and not IO objects.
|
10
|
+
* It adds formats for rational, complex, and quoted string data.
|
11
|
+
* It adopts a more uniform approach to eating (or not eating) superfluous spaces.
|
12
|
+
* Unsigned integer data are not allowed to be negative.
|
13
|
+
|
7
14
|
## Installation
|
8
15
|
|
9
16
|
Add this line to your application's Gemfile:
|
@@ -141,23 +148,26 @@ returns ["a", "b", "c"]
|
|
141
148
|
|
142
149
|
I ran a test just to make sure that ruby_sscanf was not terribly
|
143
150
|
under-performant when compared to the ruby standard library version. I was
|
144
|
-
|
151
|
+
pleased to see that in fact ruby_sscanf was faster. Here are the results:
|
145
152
|
|
146
|
-
|
153
|
+
Warming up --------------------------------------
|
147
154
|
Scan strings with ruby_sscanf
|
148
|
-
1.
|
155
|
+
1.594k i/100ms
|
149
156
|
Scan strings with scanf
|
150
|
-
|
151
|
-
|
157
|
+
305.000 i/100ms
|
158
|
+
Calculating -------------------------------------
|
152
159
|
Scan strings with ruby_sscanf
|
153
|
-
|
160
|
+
16.419k (± 4.9%) i/s - 82.888k
|
154
161
|
Scan strings with scanf
|
155
|
-
3.
|
162
|
+
3.077k (± 6.2%) i/s - 15.555k
|
156
163
|
|
157
164
|
Comparison:
|
158
|
-
Scan strings with ruby_sscanf:
|
159
|
-
Scan strings with scanf:
|
165
|
+
Scan strings with ruby_sscanf: 16418.6 i/s
|
166
|
+
Scan strings with scanf: 3077.1 i/s - 5.34x slower
|
160
167
|
|
168
|
+
This benchmark test was run under:
|
169
|
+
* ruby 2.1.6p336 (2015-04-13 revision 50298) [i386-mingw32]
|
170
|
+
* format_engine version = 0.5.2
|
161
171
|
|
162
172
|
## Contributing
|
163
173
|
|
data/lib/ruby_sscanf/version.rb
CHANGED
data/ruby_sscanf.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_development_dependency "bundler", "~> 1.11"
|
28
28
|
spec.add_development_dependency "rake", "~> 10.0"
|
29
29
|
spec.add_development_dependency 'minitest', "~> 5.5.1"
|
30
|
-
spec.add_development_dependency 'minitest_visible', "
|
30
|
+
spec.add_development_dependency 'minitest_visible', ">= 0.1.0"
|
31
31
|
spec.add_development_dependency 'rdoc', "~> 4.0.1"
|
32
32
|
|
33
33
|
end
|
data/tests/scan_tests.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_sscanf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Camilleri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: format_engine
|
@@ -70,16 +70,16 @@ dependencies:
|
|
70
70
|
name: minitest_visible
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.0
|
75
|
+
version: 0.1.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.0
|
82
|
+
version: 0.1.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rdoc
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|