jserializer 0.1.0 → 0.2.0

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: eff59fc3af48019c3a9800760d5d09c58a934c78
4
- data.tar.gz: 308fc34cd019fd9c29a0e5b06dc9068ee19c431c
3
+ metadata.gz: 1d87f4dc464c30f4e4d7f1655e0019101239f8f7
4
+ data.tar.gz: d0f5b36f117596ad250a4bef5610365f6ca1a5da
5
5
  SHA512:
6
- metadata.gz: 87093b362a7810c4a65475790f91e80c55ea450c9c459c053e7bd0582eb402b46583d5332e5d47d62444fd7b71ea189ba84ba0d0deb73e82a2f2f21697c7a53b
7
- data.tar.gz: be66e3b62de854ceb486e329f8678a2ea767b54352452911d39eccffbaeeb650003a1e4dea9f9542c98206a3bd571b02dc1073d7332a95c87c596a2240321f2b
6
+ metadata.gz: 8f314d8efac6a860b2fde2c33fbb118adc42fc8aa7b0cc4f283efcf4c49ae290051f2df2e5e7517a48ae1db4d72263a51ae34063887e4e56d289697bbe13ab33
7
+ data.tar.gz: 8a6be0195282b6df82fa15da9d8390d99d5b3e0ed069acca7d2e6c01f273961cf624b3d22a41fbc17c2459ab31c951cce62e7624599a225bdb9df7cb9fb1b21a
@@ -90,19 +90,21 @@ module Jserializer
90
90
  end
91
91
  end
92
92
 
93
- attr_reader :object, :options, :current_user
93
+ attr_reader :object, :options, :scope
94
+
95
+ alias :current_user :scope
94
96
 
95
97
  # supported options:
96
98
  # root:
97
99
  # meta:
98
100
  # meta_key:
99
- # current_user:
101
+ # scope or current_user:
100
102
  # is_collection:
101
103
  # only: []
102
104
  # except: []
103
105
  def initialize(object, options = {})
104
106
  @object = object
105
- @current_user = options[:current_user]
107
+ @scope = options[:scope] || options[:current_user]
106
108
  @is_collection = options.delete(:is_collection) || false
107
109
  @options = options
108
110
  _update_attributes_filter
@@ -146,7 +148,7 @@ module Jserializer
146
148
  end
147
149
 
148
150
  def to_json(*)
149
- ::Oj.dump(as_json, mode: :compat)
151
+ JSON.generate(as_json)
150
152
  end
151
153
 
152
154
  # Returns a hash representation with the root
data/lib/jserializer.rb CHANGED
@@ -1,3 +1,3 @@
1
- require 'oj'
1
+ require 'json'
2
2
  require 'jserializer/association'
3
3
  require 'jserializer/base'
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jserializer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Yue
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-20 00:00:00.000000000 Z
11
+ date: 2018-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: oj
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '3.0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '3.0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: bundler
29
15
  requirement: !ruby/object:Gem::Requirement