jsonl 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/.travis.yml +4 -0
- data/README.md +22 -8
- data/lib/jsonl/version.rb +1 -1
- data/test/jsonl_test.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 644b67a1de9540d0727b88c0b3ca6107cd327525
|
4
|
+
data.tar.gz: ad0af101b590b480e3313230a1347fc9dfa53f35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc0101d1c2f79ee38aad6c551245081be6ee40f8500af449473d59352a7fc16826981d5ca6e46830ba7d89580cbb9f0c5664586c67c00cac3f227b7089abfb7a
|
7
|
+
data.tar.gz: 778ed4377de1f88b942ca9e0025af736502668b5be4e9c73e443aa418e4f04f767b808c77c1b785b9350c45f953bdb37a03e347b0e7af998440e5799f6029ac1
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# JSONL
|
2
2
|
|
3
|
-
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/jsonl.svg)](https://badge.fury.io/rb/jsonl)
|
4
|
+
[![Build Status](https://travis-ci.org/kami-zh/jsonl.svg?branch=master)](https://travis-ci.org/kami-zh/jsonl)
|
4
5
|
|
5
|
-
|
6
|
+
JSONL is just a module for handling [JSONL](http://jsonlines.org) (JSON Lines) parsing with JSON module.
|
6
7
|
|
7
8
|
## Installation
|
8
9
|
|
@@ -22,18 +23,31 @@ Or install it yourself as:
|
|
22
23
|
|
23
24
|
## Usage
|
24
25
|
|
25
|
-
|
26
|
+
To parse JSONL text, just pass the source to `JSONL.parse`, which transfers the processing to `JSON.parse`.
|
26
27
|
|
27
|
-
|
28
|
+
`source.jsonl`:
|
28
29
|
|
29
|
-
|
30
|
+
```json
|
31
|
+
{"name": "Gilbert", "wins": [["straight", "7♣"], ["one pair", "10♥"]]}
|
32
|
+
{"name": "Alexa", "wins": [["two pair", "4♠"], ["two pair", "9♠"]]}
|
33
|
+
{"name": "May", "wins": []}
|
34
|
+
{"name": "Deloise", "wins": [["three of a kind", "5♣"]]}
|
35
|
+
```
|
30
36
|
|
31
|
-
|
37
|
+
```ruby
|
38
|
+
require 'jsonl'
|
32
39
|
|
33
|
-
|
40
|
+
source = File.read('source.jsonl')
|
34
41
|
|
35
|
-
|
42
|
+
parsed = JSONL.parse(source)
|
43
|
+
parsed.class #=> Array
|
44
|
+
parsed.count #=> 4
|
45
|
+
parsed[0] #=> {"name"=>"Gilbert", "wins"=>[["straight", "7♣"], ["one pair", "10♥"]]}
|
46
|
+
```
|
47
|
+
|
48
|
+
## Contributing
|
36
49
|
|
50
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/kami-zh/jsonl.
|
37
51
|
|
38
52
|
## License
|
39
53
|
|
data/lib/jsonl/version.rb
CHANGED
data/test/jsonl_test.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsonl
|
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
|
- kami-zh
|
@@ -60,6 +60,7 @@ extensions: []
|
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
62
|
- ".gitignore"
|
63
|
+
- ".travis.yml"
|
63
64
|
- Gemfile
|
64
65
|
- LICENSE.txt
|
65
66
|
- README.md
|