tnetstring 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY.rdoc +25 -0
- data/MIT-LICENSE +19 -0
- data/README.rdoc +61 -0
- data/lib/tnetstring/version.rb +1 -1
- metadata +9 -4
data/HISTORY.rdoc
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
== 0.3.2 / 2011-06-21
|
2
|
+
* Bug Fix
|
3
|
+
* Parsing Hashes with null values now works
|
4
|
+
* Feature Addition
|
5
|
+
* Hash keys may now be symbols
|
6
|
+
* TNetstring.dump method introduced, identical to TNetstring.encode
|
7
|
+
* Deprecation
|
8
|
+
* TNetstring.encode deprecated in favor of TNetstring.dump, aligning with other implementations.
|
9
|
+
== 0.3.1 / 2011-04-17
|
10
|
+
* API Change
|
11
|
+
* Error conditions raise TNetstring::ProcessError
|
12
|
+
* Documentation
|
13
|
+
* Add inline documentation and update README
|
14
|
+
== 0.3.0 / 2011-04-16
|
15
|
+
* New Feature
|
16
|
+
* Can encode primatives according to the tnetstring spec
|
17
|
+
* API Change
|
18
|
+
* TNetstring#parse now returns remainder of input
|
19
|
+
* TNetstring#parse_tnetstring removed (effectively, renamed to #parse)
|
20
|
+
== 0.2.0 / 2011-04-13
|
21
|
+
* Feature Update
|
22
|
+
* Bring parsing inline with tnetstrings.org reference spec, thanks to twopir
|
23
|
+
== 0.1.0 / 2011-04-12
|
24
|
+
* Initial Release
|
25
|
+
* Pure-Ruby implementation of Zed Shaw's initial example
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2011 Matt Yoho
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
= tnetstring-rb
|
2
|
+
|
3
|
+
Tagged netstrings were conceived by Zed Shaw as a convenient text format for
|
4
|
+
exchanging small amounts of data over the network, based on
|
5
|
+
Dan Bernstein's earlier idea, {netstrings}[http://cr.yp.to/proto/netstrings.txt].
|
6
|
+
They are meant as an alternative to JSON that are easier to handle in low-level
|
7
|
+
network code and simpler to implement.
|
8
|
+
|
9
|
+
The following set of intended characteristics of tagged netstrings is
|
10
|
+
excerpted from the {official specification}[http://tnetstrings.org/]:
|
11
|
+
|
12
|
+
* Trivial to parse in every language without making errors.
|
13
|
+
* Resistant to buffer overflows and other problems.
|
14
|
+
* Fast and low resource intensive.
|
15
|
+
* Makes no assumptions about string contents and can store binary data without escaping or encoding them.
|
16
|
+
* Backward compatible with original netstrings.
|
17
|
+
* Transport agnostic, so it works with streams, messages, files, anything that's 8-bit clean.
|
18
|
+
|
19
|
+
Tagged netstrings support the following primitives: strings, integers, booleans
|
20
|
+
(true or false), null (or nil), lists (arrays), and dictionaries (hashes).
|
21
|
+
|
22
|
+
Please see the official spec {tnetstrings.org}[http://tnetstrings.org/] for
|
23
|
+
further detail.
|
24
|
+
|
25
|
+
== Examples
|
26
|
+
|
27
|
+
Given a string in tnetstring format, it can be parsed like so:
|
28
|
+
|
29
|
+
str = '5:12345#'
|
30
|
+
TNetstring.parse(str)
|
31
|
+
|
32
|
+
#=> [12345, '']
|
33
|
+
|
34
|
+
This returns a tuple that contains the parsed object and any remaining string
|
35
|
+
input.
|
36
|
+
|
37
|
+
Encoding an object as a tnetstring is similarly straightforward:
|
38
|
+
|
39
|
+
int = 12345
|
40
|
+
TNetstring.encode(int)
|
41
|
+
|
42
|
+
#=> '5:12345#'
|
43
|
+
|
44
|
+
Please see the specs in this project for more examples.
|
45
|
+
|
46
|
+
== Installation
|
47
|
+
|
48
|
+
It's a gem, so do the usual:
|
49
|
+
|
50
|
+
gem install tnetstring
|
51
|
+
|
52
|
+
== Attribution
|
53
|
+
|
54
|
+
The initial implementation was a port of Zed's first (pre-standardization)
|
55
|
+
tnetstrings {implementation in Python}[http://codepad.org/xct0E5ac].
|
56
|
+
|
57
|
+
== The Future
|
58
|
+
|
59
|
+
Before going 1.0 the library will be converted to a native gem for performance
|
60
|
+
reasons. A native Java/JRuby implementation is planned as well. The current pure
|
61
|
+
Ruby gem may be ported to a tnetstring-pure library.
|
data/lib/tnetstring/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 3
|
9
|
+
version: 0.3.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Matt Yoho
|
@@ -53,12 +53,17 @@ executables: []
|
|
53
53
|
|
54
54
|
extensions: []
|
55
55
|
|
56
|
-
extra_rdoc_files:
|
57
|
-
|
56
|
+
extra_rdoc_files:
|
57
|
+
- HISTORY.rdoc
|
58
|
+
- MIT-LICENSE
|
59
|
+
- README.rdoc
|
58
60
|
files:
|
59
61
|
- lib/tnetstring/errors.rb
|
60
62
|
- lib/tnetstring/version.rb
|
61
63
|
- lib/tnetstring.rb
|
64
|
+
- HISTORY.rdoc
|
65
|
+
- MIT-LICENSE
|
66
|
+
- README.rdoc
|
62
67
|
has_rdoc: true
|
63
68
|
homepage: http://github.com/mattyoho/tnetstring-rb
|
64
69
|
licenses: []
|