schema_serializer 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rspec +3 -0
- data/.rubocop.yml +1 -1
- data/.travis.yml +1 -2
- data/Rakefile +3 -0
- data/lib/schema_serializer/serializable.rb +3 -1
- data/lib/schema_serializer/version.rb +1 -1
- data/lib/schema_serializer.rb +3 -2
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: df227d33a5ef9d69964b690e95f7f67735d1f342892f0bdd8a623d377b230fb2
|
|
4
|
+
data.tar.gz: 26b2b03d097d03d2e85f3b834a8c9d0dafdcee9ef362c669b4324e35eed7ee69
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fbd52e29580c17fc38d0630e263288d1c395004951e29cada24bb021c8867785c732e198353f653d2e48c1c68175d7c186e8d169987ef38c02cd693d2afeb4e9
|
|
7
|
+
data.tar.gz: b436fd8463202839a2f49b211d569c4226c2c67a823c711683c605165aff8ed72948d4ae76fe416c93aaf0bab38515596588392255c6033580cdeb8265f80d5b
|
data/.gitignore
CHANGED
data/.rspec
ADDED
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
data/Rakefile
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
class SchemaSerializer
|
|
2
2
|
module Serializable
|
|
3
|
-
def serializer(
|
|
3
|
+
def serializer(*args)
|
|
4
|
+
options = args.last.is_a?(Hash) ? args.pop : {}
|
|
5
|
+
klass = args.first || options[:class]
|
|
4
6
|
(klass || "#{self.class.name}Serializer".safe_constantize || SchemaSerializer).new(self)
|
|
5
7
|
end
|
|
6
8
|
end
|
data/lib/schema_serializer.rb
CHANGED
|
@@ -10,7 +10,7 @@ require "schema_serializer/version"
|
|
|
10
10
|
require "schema_serializer/railtie" if defined?(Rails)
|
|
11
11
|
|
|
12
12
|
class SchemaSerializer
|
|
13
|
-
attr_reader :object
|
|
13
|
+
attr_reader :object, :options
|
|
14
14
|
|
|
15
15
|
class << self
|
|
16
16
|
attr_reader :definition
|
|
@@ -29,8 +29,9 @@ class SchemaSerializer
|
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
def initialize(object,
|
|
32
|
+
def initialize(object, options = {})
|
|
33
33
|
@object = object
|
|
34
|
+
@options = options
|
|
34
35
|
end
|
|
35
36
|
|
|
36
37
|
def as_json(_options = nil)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: schema_serializer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- i2bskn
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-
|
|
11
|
+
date: 2019-10-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -156,6 +156,7 @@ extensions: []
|
|
|
156
156
|
extra_rdoc_files: []
|
|
157
157
|
files:
|
|
158
158
|
- ".gitignore"
|
|
159
|
+
- ".rspec"
|
|
159
160
|
- ".rubocop.yml"
|
|
160
161
|
- ".ruby-version"
|
|
161
162
|
- ".travis.yml"
|