plucker_serializer 0.5.0 → 0.6.0
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/lib/plucker/attribute.rb +44 -41
- data/lib/plucker/base.rb +81 -78
- data/lib/plucker/belongs_to.rb +10 -8
- data/lib/plucker/collection.rb +17 -16
- data/lib/plucker/configuration.rb +7 -7
- data/lib/plucker/descriptor.rb +34 -35
- data/lib/plucker/has_many.rb +9 -7
- data/lib/plucker/has_one.rb +10 -8
- data/lib/plucker/relationship.rb +54 -51
- data/lib/plucker/version.rb +3 -2
- data/lib/plucker_serializer.rb +20 -20
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf134b11d47d300e2df621e5f027ea881cfae344ae1a807eeb8a51b001888720
|
4
|
+
data.tar.gz: 20f2cee76e31ed9d07f69fe41013cc733b1f3194bc940425309b93639763c1aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2693c8756d65c1a32f5b0be8aa857e9b5b0c77e8574b99de84ddac9289754f8df4f97cb80cd0928c1aa40ca23588366f0433b01ae60c1668081861f29c20c50
|
7
|
+
data.tar.gz: 9a11ff786953fe594b81dea45f4fa883bbb947bae007207c5724ba0c8077cfcdc0329b9f95457379c906ef39bee27d2acd6d4059eb103184b253a9dcdedf16c4
|
data/lib/plucker/attribute.rb
CHANGED
@@ -1,48 +1,51 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Plucker
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
def initialize(name, options = {}, block)
|
7
|
-
@name = name
|
8
|
-
@block = block
|
9
|
-
@condition = options[:if]
|
10
|
-
end
|
4
|
+
class Attribute
|
5
|
+
attr_reader :name, :block, :condition
|
11
6
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
if serializer.respond_to?(@name)
|
18
|
-
serializer.send(@name)
|
19
|
-
else
|
20
|
-
serializer.object.send(@name)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
7
|
+
def initialize(name, options = {}, block)
|
8
|
+
@name = name.to_sym
|
9
|
+
@block = block&.freeze
|
10
|
+
@condition = options[:if]&.freeze
|
11
|
+
end
|
24
12
|
|
25
|
-
|
26
|
-
|
27
|
-
|
13
|
+
def value(serializer)
|
14
|
+
if @block
|
15
|
+
result = if @block.arity.zero?
|
16
|
+
serializer.object.instance_exec(&@block)
|
17
|
+
else
|
18
|
+
@block.call(serializer.object)
|
19
|
+
end
|
20
|
+
return result unless result == :nil
|
21
|
+
end
|
22
|
+
|
23
|
+
if serializer.respond_to?(@name)
|
24
|
+
serializer.public_send(@name)
|
25
|
+
else
|
26
|
+
serializer.object.public_send(@name)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def is_pluckable?
|
31
|
+
@block.blank?
|
32
|
+
end
|
28
33
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
end
|
43
|
-
else
|
44
|
-
nil
|
45
|
-
end
|
34
|
+
def should_include?(serializer)
|
35
|
+
case @condition
|
36
|
+
when nil
|
37
|
+
true
|
38
|
+
when Symbol
|
39
|
+
serializer.public_send(@condition)
|
40
|
+
when String
|
41
|
+
serializer.instance_eval(@condition)
|
42
|
+
when Proc
|
43
|
+
if @condition.arity.zero?
|
44
|
+
serializer.instance_exec(&@condition)
|
45
|
+
else
|
46
|
+
serializer.instance_exec(serializer, &@condition)
|
46
47
|
end
|
48
|
+
end
|
47
49
|
end
|
48
|
-
end
|
50
|
+
end
|
51
|
+
end
|
data/lib/plucker/base.rb
CHANGED
@@ -1,108 +1,111 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require_relative 'concerns/caching'
|
3
4
|
require_relative 'descriptor'
|
4
5
|
require_relative 'has_many'
|
5
6
|
require_relative 'belongs_to'
|
6
7
|
require_relative 'has_one'
|
7
|
-
require
|
8
|
+
require 'oj'
|
8
9
|
require 'active_support/all'
|
9
10
|
|
10
11
|
module Plucker
|
11
|
-
|
12
|
-
|
12
|
+
class Base
|
13
|
+
include Caching
|
13
14
|
|
14
|
-
|
15
|
+
attr_accessor :object
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
with_options instance_writer: false, instance_reader: false do |serializer|
|
18
|
+
serializer.class_attribute :_descriptor
|
19
|
+
self._descriptor ||= Plucker::Descriptor.new(self.class)
|
20
|
+
end
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
def self.inherited(base)
|
23
|
+
super
|
24
|
+
base._descriptor = Plucker::Descriptor.new(base)
|
25
|
+
end
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
27
|
+
def initialize(object, options = {})
|
28
|
+
self.object = object
|
29
|
+
end
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
end
|
35
|
-
else
|
36
|
-
get_hash
|
37
|
-
end
|
31
|
+
def serializable_hash(use_cache: true)
|
32
|
+
if use_cache && self.class.cache_enabled?
|
33
|
+
fetch(adapter: :hash) do
|
34
|
+
get_hash
|
38
35
|
end
|
39
|
-
|
40
|
-
|
36
|
+
else
|
37
|
+
get_hash
|
38
|
+
end
|
39
|
+
end
|
40
|
+
alias to_hash serializable_hash
|
41
|
+
alias to_h serializable_hash
|
41
42
|
|
42
|
-
|
43
|
-
|
44
|
-
|
43
|
+
def as_json(options = nil)
|
44
|
+
serializable_hash
|
45
|
+
end
|
45
46
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
end
|
51
|
-
else
|
52
|
-
Oj.dump(get_hash, mode: :rails)
|
53
|
-
end
|
47
|
+
def to_json(options = {}, use_cache: true)
|
48
|
+
if use_cache && self.class.cache_enabled?
|
49
|
+
fetch(adapter: :json) do
|
50
|
+
Oj.dump(get_hash, mode: :rails)
|
54
51
|
end
|
52
|
+
else
|
53
|
+
Oj.dump(get_hash, mode: :rails)
|
54
|
+
end
|
55
|
+
end
|
55
56
|
|
56
|
-
|
57
|
-
|
58
|
-
|
57
|
+
def get_hash
|
58
|
+
attributes_hash.merge! associations_hash
|
59
|
+
end
|
59
60
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
hash[key.to_s] = relationship.value(self)
|
64
|
-
end
|
65
|
-
end
|
61
|
+
def associations_hash
|
62
|
+
self.class._descriptor._relationships.each_with_object({}) do |(key, relationship), hash|
|
63
|
+
next unless relationship.should_include?(self)
|
66
64
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
hash[key.to_s] = attr.value(self)
|
71
|
-
end
|
72
|
-
end
|
65
|
+
hash[key.to_s] = relationship.value(self)
|
66
|
+
end
|
67
|
+
end
|
73
68
|
|
74
|
-
|
75
|
-
|
76
|
-
|
69
|
+
def attributes_hash
|
70
|
+
self.class._descriptor._attributes.each_with_object({}) do |(key, attr), hash|
|
71
|
+
next unless attr.should_include?(self)
|
77
72
|
|
78
|
-
|
79
|
-
|
80
|
-
|
73
|
+
hash[key.to_s] = attr.value(self)
|
74
|
+
end
|
75
|
+
end
|
81
76
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
end
|
86
|
-
end
|
77
|
+
def self.is_pluckable?
|
78
|
+
self._descriptor.is_pluckable?
|
79
|
+
end
|
87
80
|
|
88
|
-
|
89
|
-
|
90
|
-
|
81
|
+
def self.pluckable_columns
|
82
|
+
self._descriptor._pluckable_columns
|
83
|
+
end
|
91
84
|
|
92
|
-
|
93
|
-
|
94
|
-
|
85
|
+
def self.attributes(*attrs)
|
86
|
+
attrs.each do |attr|
|
87
|
+
attribute(attr)
|
88
|
+
end
|
89
|
+
end
|
95
90
|
|
96
|
-
|
97
|
-
|
98
|
-
|
91
|
+
def self.attribute(attr, options = {}, &block)
|
92
|
+
self._descriptor.add_attribute(options.fetch(:key, attr), Plucker::Attribute.new(attr, options, block))
|
93
|
+
end
|
99
94
|
|
100
|
-
|
101
|
-
|
102
|
-
|
95
|
+
def self.belongs_to(attr, options = {}, &block)
|
96
|
+
self._descriptor.add_relationship(options.fetch(:key, attr), Plucker::BelongsTo.new(attr, options, block))
|
97
|
+
end
|
103
98
|
|
104
|
-
|
105
|
-
|
106
|
-
|
99
|
+
def self.has_one(attr, options = {}, &block)
|
100
|
+
self._descriptor.add_relationship(options.fetch(:key, attr), Plucker::HasOne.new(attr, options, block))
|
101
|
+
end
|
102
|
+
|
103
|
+
def self.has_many(attr, options = {}, &block)
|
104
|
+
self._descriptor.add_relationship(options.fetch(:key, attr), Plucker::HasMany.new(attr, options, block))
|
105
|
+
end
|
106
|
+
|
107
|
+
def self.model(attr)
|
108
|
+
self._descriptor.set_model(attr)
|
107
109
|
end
|
108
|
-
end
|
110
|
+
end
|
111
|
+
end
|
data/lib/plucker/belongs_to.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
|
+
require_relative 'relationship'
|
3
4
|
|
4
5
|
module Plucker
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
class BelongsTo < Plucker::Relationship
|
7
|
+
def value(serializer)
|
8
|
+
relationship_object = associated_object(serializer)
|
9
|
+
return nil if relationship_object.blank?
|
10
|
+
|
11
|
+
relationship_serializer(serializer, relationship_object).new(relationship_object).serializable_hash
|
11
12
|
end
|
12
|
-
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/plucker/collection.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require_relative 'concerns/caching'
|
3
|
-
require
|
4
|
-
require
|
4
|
+
require 'oj'
|
5
|
+
require 'pluck_all'
|
5
6
|
|
6
7
|
module Plucker
|
7
8
|
class Collection
|
@@ -18,22 +19,20 @@ module Plucker
|
|
18
19
|
end
|
19
20
|
|
20
21
|
def serializable_hash
|
21
|
-
if
|
22
|
+
if !objects.is_a?(ActiveRecord::Relation)
|
22
23
|
objects.map do |object|
|
23
24
|
serializer_class.new(object).serializable_hash
|
24
25
|
end.compact
|
25
|
-
|
26
|
-
if
|
27
|
-
|
28
|
-
|
29
|
-
get_hash(use_cache: false)
|
30
|
-
end
|
31
|
-
elsif @cache_type == :multi
|
32
|
-
get_hash(use_cache: true)
|
26
|
+
elsif serializer_class.cache_enabled?
|
27
|
+
if @cache_type == :collection
|
28
|
+
fetch(adapter: :hash) do
|
29
|
+
get_hash(use_cache: false)
|
33
30
|
end
|
34
|
-
|
35
|
-
get_hash(use_cache:
|
31
|
+
elsif @cache_type == :multi
|
32
|
+
get_hash(use_cache: true)
|
36
33
|
end
|
34
|
+
else
|
35
|
+
get_hash(use_cache: false)
|
37
36
|
end
|
38
37
|
end
|
39
38
|
alias to_hash serializable_hash
|
@@ -79,20 +78,22 @@ module Plucker
|
|
79
78
|
|
80
79
|
def cache_version
|
81
80
|
return @cache_version if defined?(@cache_version)
|
81
|
+
|
82
82
|
@cache_version = objects.cache_version
|
83
83
|
end
|
84
84
|
|
85
85
|
def cache_key(adapter: :json)
|
86
|
-
objects.cache_key
|
86
|
+
"#{objects.cache_key}/#{serializer_class._cache_digest}/#{adapter}"
|
87
87
|
end
|
88
88
|
|
89
89
|
private
|
90
|
+
|
90
91
|
def associated_hash
|
91
92
|
pluck_to_hash(objects, serializer_class.pluckable_columns.to_a)
|
92
93
|
end
|
93
94
|
|
94
95
|
def pluck_to_hash(objects, attrs)
|
95
|
-
namespaced_attrs = attrs.map { |attr| objects.model.table_name
|
96
|
+
namespaced_attrs = attrs.map { |attr| "#{objects.model.table_name}.#{attr}" }
|
96
97
|
objects.pluck_all(namespaced_attrs.join(','))
|
97
98
|
end
|
98
99
|
|
@@ -104,4 +105,4 @@ module Plucker
|
|
104
105
|
end
|
105
106
|
end
|
106
107
|
end
|
107
|
-
end
|
108
|
+
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Plucker
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
end
|
4
|
+
class Configuration
|
5
|
+
attr_accessor :cache_store
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@cache_store = nil
|
10
9
|
end
|
11
|
-
end
|
10
|
+
end
|
11
|
+
end
|
data/lib/plucker/descriptor.rb
CHANGED
@@ -1,44 +1,43 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Plucker
|
3
|
-
|
4
|
-
|
4
|
+
class Descriptor
|
5
|
+
attr_accessor :_serialized_model, :_attributes, :_relationships, :_pluckable_columns, :_is_pluckable
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
7
|
+
def initialize(serializer_class)
|
8
|
+
self._serialized_model = get_serialized_model(serializer_class)
|
9
|
+
self._attributes = {}
|
10
|
+
self._relationships = {}
|
11
|
+
self._pluckable_columns = Set.new
|
12
|
+
self._is_pluckable = true
|
13
|
+
end
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
15
|
+
def is_pluckable?
|
16
|
+
_is_pluckable
|
17
|
+
end
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
19
|
+
def add_attribute(key, attr)
|
20
|
+
_attributes[key] = attr
|
21
|
+
if attr.is_pluckable? && _serialized_model&.column_names&.include?(attr.name.to_s)
|
22
|
+
_pluckable_columns << attr.name
|
23
|
+
else
|
24
|
+
self._is_pluckable = false
|
25
|
+
end
|
26
|
+
end
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
def add_relationship(key, relationship)
|
29
|
+
_relationships[key] = relationship
|
30
|
+
self._is_pluckable = false
|
31
|
+
end
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
|
33
|
+
def set_model(model)
|
34
|
+
self._serialized_model = model
|
35
|
+
end
|
35
36
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
nil
|
41
|
-
end
|
42
|
-
end
|
37
|
+
def get_serialized_model(serializer_class)
|
38
|
+
serializer_class.name.split(/Serializer/).first.constantize
|
39
|
+
rescue NameError, LoadError => e
|
40
|
+
nil
|
43
41
|
end
|
44
|
-
end
|
42
|
+
end
|
43
|
+
end
|
data/lib/plucker/has_many.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative
|
2
|
+
|
3
|
+
require_relative 'relationship'
|
4
|
+
require_relative 'collection'
|
4
5
|
|
5
6
|
module Plucker
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
class HasMany < Plucker::Relationship
|
8
|
+
def value(serializer)
|
9
|
+
Plucker::Collection.new(associated_object(serializer),
|
10
|
+
serializer: relationship_serializer(serializer)).serializable_hash
|
10
11
|
end
|
11
|
-
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/plucker/has_one.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
|
+
require_relative 'relationship'
|
3
4
|
|
4
5
|
module Plucker
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
class HasOne < Plucker::Relationship
|
7
|
+
def value(serializer)
|
8
|
+
relationship_object = associated_object(serializer)
|
9
|
+
return nil if relationship_object.blank?
|
10
|
+
|
11
|
+
relationship_serializer(serializer, relationship_object).new(relationship_object).serializable_hash
|
11
12
|
end
|
12
|
-
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/plucker/relationship.rb
CHANGED
@@ -1,61 +1,64 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require_relative 'collection'
|
3
4
|
|
4
5
|
module Plucker
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
def initialize(name, options = {}, block)
|
9
|
-
@name = name
|
10
|
-
@block = block
|
11
|
-
@options = options
|
12
|
-
@condition = options[:if]
|
13
|
-
end
|
6
|
+
class Relationship
|
7
|
+
attr_reader :name, :block, :options, :condition
|
14
8
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
when String
|
22
|
-
serializer.instance_eval(@condition)
|
23
|
-
when Proc
|
24
|
-
if @condition.arity.zero?
|
25
|
-
serializer.instance_exec(&@condition)
|
26
|
-
else
|
27
|
-
serializer.instance_exec(serializer, &@condition)
|
28
|
-
end
|
29
|
-
else
|
30
|
-
nil
|
31
|
-
end
|
32
|
-
end
|
9
|
+
def initialize(name, options = {}, block)
|
10
|
+
@name = name.to_sym
|
11
|
+
@block = block&.freeze
|
12
|
+
@options = options.freeze
|
13
|
+
@condition = options[:if]&.freeze
|
14
|
+
end
|
33
15
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
16
|
+
def should_include?(serializer)
|
17
|
+
case @condition
|
18
|
+
when nil
|
19
|
+
true
|
20
|
+
when Symbol
|
21
|
+
serializer.public_send(@condition)
|
22
|
+
when String
|
23
|
+
serializer.instance_eval(@condition)
|
24
|
+
when Proc
|
25
|
+
if @condition.arity.zero?
|
26
|
+
serializer.instance_exec(&@condition)
|
27
|
+
else
|
28
|
+
serializer.instance_exec(serializer, &@condition)
|
41
29
|
end
|
30
|
+
end
|
31
|
+
end
|
42
32
|
|
43
|
-
|
44
|
-
|
45
|
-
|
33
|
+
def associated_object(serializer)
|
34
|
+
if @block
|
35
|
+
result = if @block.arity.zero?
|
36
|
+
serializer.object.instance_exec(&@block)
|
37
|
+
else
|
38
|
+
@block.call(serializer.object)
|
39
|
+
end
|
40
|
+
return result if result != :nil
|
41
|
+
end
|
42
|
+
serializer.object.public_send(@name)
|
43
|
+
end
|
46
44
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
45
|
+
def value(serializer)
|
46
|
+
nil
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def relationship_serializer(serializer, relationship_object = nil)
|
52
|
+
if @options[:serializer].blank?
|
53
|
+
association_class = if relationship_object.present?
|
54
|
+
relationship_object.class.name
|
55
|
+
else
|
56
|
+
serializer.object.class.reflect_on_association(@name.to_sym).class_name
|
57
|
+
end
|
58
|
+
"#{association_class.demodulize.camelize}Serializer".constantize
|
59
|
+
else
|
60
|
+
@options[:serializer]
|
61
|
+
end
|
60
62
|
end
|
61
|
-
end
|
63
|
+
end
|
64
|
+
end
|
data/lib/plucker/version.rb
CHANGED
data/lib/plucker_serializer.rb
CHANGED
@@ -1,23 +1,23 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require
|
1
|
+
require 'plucker/version'
|
2
|
+
require 'plucker/configuration'
|
3
|
+
require 'plucker/base'
|
4
|
+
require 'plucker/attribute'
|
5
|
+
require 'plucker/collection'
|
6
|
+
require 'plucker/relationship'
|
7
|
+
require 'plucker/belongs_to'
|
8
|
+
require 'plucker/has_one'
|
9
|
+
require 'plucker/has_many'
|
10
|
+
require 'plucker/descriptor'
|
11
|
+
require 'plucker/concerns/caching'
|
12
12
|
|
13
13
|
module Plucker
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
def configure
|
20
|
-
yield(config)
|
21
|
-
end
|
14
|
+
class << self
|
15
|
+
def config
|
16
|
+
@config ||= Configuration.new
|
22
17
|
end
|
23
|
-
|
18
|
+
|
19
|
+
def configure
|
20
|
+
yield(config)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plucker_serializer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henry Boisgibault
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
93
|
- !ruby/object:Gem::Version
|
94
94
|
version: '0'
|
95
95
|
requirements: []
|
96
|
-
rubygems_version: 3.
|
96
|
+
rubygems_version: 3.5.11
|
97
97
|
signing_key:
|
98
98
|
specification_version: 4
|
99
99
|
summary: A blazing fast JSON serializer for ActiveRecord & Ruby objects
|