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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c8ecadbd203bf7a77c7cf6164cd91132773ac807
4
- data.tar.gz: 852a80db79a9e23c10b7bd78c383e88ca23113ff
3
+ metadata.gz: 644b67a1de9540d0727b88c0b3ca6107cd327525
4
+ data.tar.gz: ad0af101b590b480e3313230a1347fc9dfa53f35
5
5
  SHA512:
6
- metadata.gz: 02f30a0d0edb576df33e75e8a1e69d267ce575930fe31870f2d4e74e5e2f001fa55ccb1c4b5c1fa7385f6bb5e751992ab1aad565785f9d3a4cd48c40a78708e9
7
- data.tar.gz: a5ca4ed9494b8381cf5cf80c993c2d804b7dd47b7522339174586850a5cb5c392649ee03f4e84a08678317430b5c88eacce3d4324a6bab49c04ebfe74e3a6f8a
6
+ metadata.gz: fc0101d1c2f79ee38aad6c551245081be6ee40f8500af449473d59352a7fc16826981d5ca6e46830ba7d89580cbb9f0c5664586c67c00cac3f227b7089abfb7a
7
+ data.tar.gz: 778ed4377de1f88b942ca9e0025af736502668b5be4e9c73e443aa418e4f04f767b808c77c1b785b9350c45f953bdb37a03e347b0e7af998440e5799f6029ac1
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ before_install: gem install bundler -v 1.14.0
data/README.md CHANGED
@@ -1,8 +1,9 @@
1
1
  # JSONL
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/jsonl`. To experiment with that code, run `bin/console` for an interactive prompt.
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
- TODO: Delete this and the text above, and describe your gem
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
- TODO: Write usage instructions here
26
+ To parse JSONL text, just pass the source to `JSONL.parse`, which transfers the processing to `JSON.parse`.
26
27
 
27
- ## Development
28
+ `source.jsonl`:
28
29
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
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
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
37
+ ```ruby
38
+ require 'jsonl'
32
39
 
33
- ## Contributing
40
+ source = File.read('source.jsonl')
34
41
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/kami-zh/jsonl. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
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
 
@@ -1,3 +1,3 @@
1
1
  module JSONL
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
@@ -8,7 +8,7 @@ class JSONLTest < Minitest::Test
8
8
  end
9
9
 
10
10
  def test_parsed_class
11
- assert_equal Array, @parsed.class
11
+ assert_instance_of Array, @parsed
12
12
  end
13
13
 
14
14
  def test_parsed_count
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.2
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