mongo-ejson 0.2.0 → 0.2.1

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
  SHA256:
3
- metadata.gz: ad82ad33cec308c20018042c44a50361619d79813bb866e830126794f35daed1
4
- data.tar.gz: 7d2bec415b3328b6c112e382819f3d6c9b0b97fbdbbbf3d40ec4779a8926b36c
3
+ metadata.gz: 7fe75002ec17489608405072b1cf5e19643bce4732f97fc74c42a7d4c77f331a
4
+ data.tar.gz: 9ffd4f54c57599d7c97081f6fdf7ee27bd3075bb7ae95cf659910d9e20f1a8af
5
5
  SHA512:
6
- metadata.gz: 7fcd47f32cbb62d40ea9d268746f4bd7ebb8611a5c044297c16bb4a9dbd14d7d79933f6a0bf4b58d731c93d7bc7abe2dac3cf281ce1a62ea3d956abec3c8a826
7
- data.tar.gz: 412d8ed39076c303b704016dfda59d25ad05a7e40a5314a430d59b5fdaf7902fe0a18f019100b9ebbf77a0715f5a455c1a01559d7247f6a758fe130871243199
6
+ metadata.gz: 4def483883272fd0938a362fd6edd41131f4b9e633aefca1ab3b2f793f9078730eb0026e0010cc602c4152b68faa52a02edb790bef5a6951a714880d32135c9a
7
+ data.tar.gz: 17cf8d185b2dcfa62e654b6752cba2f0ebd4eba6c0e2665b98117b19698c72786f035ed23f950d4b9abe059c2f4d38527587c12276487ddb9e57ca2e8180c38d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mongo-ejson (0.2.0)
4
+ mongo-ejson (0.2.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,11 +1,44 @@
1
1
  # mongo-ejson
2
2
 
3
- [![Build Status](https://travis-ci.org/db-ai/mongo-ejson.svg?branch=master)](https://travis-ci.org/db-ai/mongo-ejson)
3
+ [![Build Status](https://travis-ci.org/db-ai/mongo-ejson.svg?branch=master)](https://travis-ci.org/db-ai/mongo-ejson) [![Gem Version](https://badge.fury.io/rb/mongo-ejson.svg)](https://badge.fury.io/rb/mongo-ejson)
4
4
 
5
5
  This is a parser for mongo "flavoured" JSON, that supports mongo specific literals like `ISODate` or `ObjectId`, as well as some other nasty non-json things.
6
6
 
7
7
  It can instantiate corresponding BSON objects or produce Extended JSON objects.
8
8
 
9
+ ## Usage
10
+
11
+ Add gem to your Gemfile:
12
+
13
+ gem 'mongo-ejson'
14
+
15
+ Require when needed:
16
+
17
+ require 'ejson'
18
+
19
+ You can parse files in two modes: `Wrap` and `BSON`.
20
+
21
+ In `Wrap` mode, parser will instantiate Struct classes. It's useful when you
22
+ only need to validate provided EJSON code.
23
+
24
+ EJSON.parse_wrap(%q|{ "_id": ObjectId('5c520a538628ea8c13261c64') }|)
25
+ => {"_id"=>#<struct Struct::ObjectId hex="5c520a538628ea8c13261c64">}
26
+
27
+ To use `BSON` mode you need to install `bson` gem. In this case parser will
28
+ instantiate real BSON objects.
29
+
30
+ require 'bson'
31
+ EJSON.parse_bson(%q|{ "_id": ObjectId('5c520a538628ea8c13261c64') }|)
32
+ => {"_id"=>BSON::ObjectId('5c520a538628ea8c13261c64')}
33
+
34
+ You can also use JavaScript parser in your Rails application. At the moment it
35
+ does not build JavaScript object and returns raw parse tree. It is useful only
36
+ for validating the syntax.
37
+
38
+ Just add it to your `application.js`
39
+
40
+ //= require 'ejson'
41
+
9
42
  ## Requirements
10
43
 
11
44
  Runtime:
@@ -42,6 +75,7 @@ Development:
42
75
 
43
76
  ## Planned JSON extensions:
44
77
 
78
+ * Non-quoted key names: `{_id: 123}`
45
79
  * Multi-line comments: `/* */`
46
80
 
47
81
  ## Issues
data/Rakefile CHANGED
@@ -22,5 +22,5 @@ end
22
22
 
23
23
  desc "Prepare assets"
24
24
  task :assets => [:test, :compile_js] do
25
- mv 'src/ejson.js', 'lib/assets/ejson.js'
25
+ mv 'src/ejson.js', 'vendor/assets/javascripts/ejson.js'
26
26
  end
data/lib/ejson/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class EJSON
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongo-ejson
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Bondar
@@ -83,7 +83,6 @@ files:
83
83
  - bin/console
84
84
  - bin/setup
85
85
  - ejson.gemspec
86
- - lib/assets/ejson.js
87
86
  - lib/ejson.rb
88
87
  - lib/ejson/parser_action/abstract.rb
89
88
  - lib/ejson/parser_action/abstract_json.rb
@@ -97,6 +96,7 @@ files:
97
96
  - lib/ejson/version.rb
98
97
  - src/ejson.peg
99
98
  - src/ejson.rb
99
+ - vendor/assets/javascripts/ejson.js
100
100
  homepage: https://gibhub.com/db-ai/mongo-ejson
101
101
  licenses: []
102
102
  metadata: