panko_serializer 0.7.6 → 0.7.9
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/.github/workflows/docs.yml +1 -1
- data/.github/workflows/lint.yml +41 -0
- data/.github/workflows/ruby.yml +35 -36
- data/.standard.yml +4 -0
- data/Gemfile +3 -2
- data/Rakefile +12 -16
- data/benchmarks/allocs.rb +1 -1
- data/benchmarks/app.rb +1 -1
- data/benchmarks/benchmarking_support.rb +3 -3
- data/benchmarks/bm_ams_0_10.rb +2 -5
- data/benchmarks/bm_object_writer.rb +1 -0
- data/benchmarks/bm_panko_json.rb +1 -1
- data/benchmarks/bm_panko_object.rb +1 -2
- data/benchmarks/bm_plain_object.rb +7 -7
- data/benchmarks/bm_serialization_descriptor.rb +5 -5
- data/benchmarks/bm_serializer_resolver.rb +1 -0
- data/benchmarks/bm_to_object.rb +2 -10
- data/benchmarks/profile.rb +5 -7
- data/benchmarks/sanity.rb +2 -10
- data/benchmarks/setup.rb +2 -2
- data/benchmarks/type_casts/bm_active_record.rb +6 -8
- data/benchmarks/type_casts/bm_panko.rb +11 -11
- data/benchmarks/type_casts/support.rb +6 -2
- data/docs/docs/introduction.md +1 -1
- data/docs/docs/performance.md +6 -6
- data/docs/package-lock.json +12556 -168
- data/ext/panko_serializer/attributes_writer/active_record.c +6 -6
- data/ext/panko_serializer/attributes_writer/active_record.h +1 -2
- data/ext/panko_serializer/attributes_writer/attributes_writer.c +5 -7
- data/ext/panko_serializer/attributes_writer/attributes_writer.h +7 -2
- data/ext/panko_serializer/attributes_writer/common.h +2 -1
- data/ext/panko_serializer/attributes_writer/hash.c +3 -2
- data/ext/panko_serializer/attributes_writer/hash.h +2 -4
- data/ext/panko_serializer/attributes_writer/plain.c +2 -1
- data/ext/panko_serializer/attributes_writer/plain.h +2 -4
- data/ext/panko_serializer/attributes_writer/type_cast/type_cast.c +9 -9
- data/ext/panko_serializer/attributes_writer/type_cast/type_cast.h +2 -3
- data/ext/panko_serializer/common.h +0 -2
- data/ext/panko_serializer/panko_serializer.c +6 -8
- data/ext/panko_serializer/serialization_descriptor/association.c +1 -0
- data/ext/panko_serializer/serialization_descriptor/association.h +1 -1
- data/ext/panko_serializer/serialization_descriptor/attribute.c +1 -0
- data/ext/panko_serializer/serialization_descriptor/attribute.h +2 -2
- data/ext/panko_serializer/serialization_descriptor/serialization_descriptor.c +1 -1
- data/ext/panko_serializer/serialization_descriptor/serialization_descriptor.h +1 -1
- data/lib/panko/attribute.rb +5 -5
- data/lib/panko/object_writer.rb +5 -1
- data/lib/panko/response.rb +3 -3
- data/lib/panko/serialization_descriptor.rb +2 -2
- data/lib/panko/serializer.rb +8 -2
- data/lib/panko/serializer_resolver.rb +7 -4
- data/lib/panko/version.rb +1 -1
- data/panko_serializer.gemspec +8 -8
- metadata +5 -3
@@ -56,7 +56,7 @@ struct attributes init_context(VALUE obj) {
|
|
56
56
|
if (RB_TYPE_P(attributes_container, T_HASH)) {
|
57
57
|
attributes_ctx.attributes_hash = attributes_container;
|
58
58
|
} else {
|
59
|
-
if(is_lazy_attributes_set_defined == false) {
|
59
|
+
if (is_lazy_attributes_set_defined == false) {
|
60
60
|
volatile VALUE delegate_hash =
|
61
61
|
rb_ivar_get(attributes_container, delegate_hash_id);
|
62
62
|
|
@@ -84,13 +84,13 @@ struct attributes init_context(VALUE obj) {
|
|
84
84
|
return attributes_ctx;
|
85
85
|
}
|
86
86
|
|
87
|
-
VALUE read_attribute(struct attributes attributes_ctx, Attribute attribute,
|
87
|
+
VALUE read_attribute(struct attributes attributes_ctx, Attribute attribute,
|
88
|
+
VALUE* isJson) {
|
88
89
|
volatile VALUE member, value;
|
89
90
|
|
90
91
|
member = attribute->name_str;
|
91
92
|
value = Qnil;
|
92
93
|
|
93
|
-
|
94
94
|
if (!NIL_P(attributes_ctx.attributes_hash)) {
|
95
95
|
volatile VALUE attribute_metadata =
|
96
96
|
rb_hash_aref(attributes_ctx.attributes_hash, member);
|
@@ -108,7 +108,6 @@ VALUE read_attribute(struct attributes attributes_ctx, Attribute attribute, VALU
|
|
108
108
|
value = rb_hash_aref(attributes_ctx.values, member);
|
109
109
|
}
|
110
110
|
|
111
|
-
|
112
111
|
if (NIL_P(attribute->type) && !NIL_P(value)) {
|
113
112
|
if (attributes_ctx.tryToReadFromAdditionalTypes == true) {
|
114
113
|
attribute->type = rb_hash_aref(attributes_ctx.additional_types, member);
|
@@ -137,13 +136,14 @@ VALUE detect_active_model_changes(VALUE v) {
|
|
137
136
|
rb_const_get_at(rb_cObject, rb_intern("ActiveModel"));
|
138
137
|
|
139
138
|
is_lazy_attributes_set_defined =
|
140
|
-
|
139
|
+
rb_const_defined(active_model_type, rb_intern("LazyAttributeSet")) > 0;
|
141
140
|
|
142
141
|
return Qundef;
|
143
142
|
}
|
144
143
|
|
145
144
|
void active_record_attributes_writer(VALUE obj, VALUE attributes,
|
146
|
-
EachAttributeFunc write_value,
|
145
|
+
EachAttributeFunc write_value,
|
146
|
+
VALUE writer) {
|
147
147
|
if (type_detection_ran == false) {
|
148
148
|
// If ActiveModel can't be found it will throw error
|
149
149
|
int isErrored;
|
@@ -8,8 +8,7 @@
|
|
8
8
|
#include "serialization_descriptor/attribute.h"
|
9
9
|
#include "type_cast/type_cast.h"
|
10
10
|
|
11
|
-
extern void active_record_attributes_writer(VALUE object,
|
12
|
-
VALUE attributes,
|
11
|
+
extern void active_record_attributes_writer(VALUE object, VALUE attributes,
|
13
12
|
EachAttributeFunc func,
|
14
13
|
VALUE writer);
|
15
14
|
|
@@ -24,18 +24,16 @@ AttributesWriter create_attributes_writer(VALUE object) {
|
|
24
24
|
int isErrored;
|
25
25
|
rb_protect(init_types, Qnil, &isErrored);
|
26
26
|
|
27
|
-
|
28
27
|
if (ar_base_type != Qundef &&
|
29
28
|
rb_obj_is_kind_of(object, ar_base_type) == Qtrue) {
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
.write_attributes = active_record_attributes_writer};
|
29
|
+
return (AttributesWriter){
|
30
|
+
.object_type = ActiveRecord,
|
31
|
+
.write_attributes = active_record_attributes_writer};
|
34
32
|
}
|
35
33
|
|
36
34
|
if (!RB_SPECIAL_CONST_P(object) && BUILTIN_TYPE(object) == T_HASH) {
|
37
35
|
return (AttributesWriter){.object_type = Hash,
|
38
|
-
|
36
|
+
.write_attributes = hash_attributes_writer};
|
39
37
|
}
|
40
38
|
|
41
39
|
return (AttributesWriter){.object_type = Plain,
|
@@ -48,7 +46,7 @@ void empty_write_attributes(VALUE obj, VALUE attributes, EachAttributeFunc func,
|
|
48
46
|
VALUE writer) {}
|
49
47
|
|
50
48
|
AttributesWriter create_empty_attributes_writer() {
|
51
|
-
return (AttributesWriter){.object_type =
|
49
|
+
return (AttributesWriter){.object_type = UnknownObjectType,
|
52
50
|
.write_attributes = empty_write_attributes};
|
53
51
|
}
|
54
52
|
|
@@ -4,10 +4,15 @@
|
|
4
4
|
|
5
5
|
#include "active_record.h"
|
6
6
|
#include "common.h"
|
7
|
-
#include "plain.h"
|
8
7
|
#include "hash.h"
|
8
|
+
#include "plain.h"
|
9
9
|
|
10
|
-
enum ObjectType {
|
10
|
+
enum ObjectType {
|
11
|
+
UnknownObjectType = 0,
|
12
|
+
ActiveRecord = 1,
|
13
|
+
Plain = 2,
|
14
|
+
Hash = 3
|
15
|
+
};
|
11
16
|
|
12
17
|
typedef struct _AttributesWriter {
|
13
18
|
enum ObjectType object_type;
|
@@ -3,6 +3,7 @@
|
|
3
3
|
#include "../serialization_descriptor/attribute.h"
|
4
4
|
#include "ruby.h"
|
5
5
|
|
6
|
-
typedef void (*EachAttributeFunc)(VALUE writer, VALUE name, VALUE value,
|
6
|
+
typedef void (*EachAttributeFunc)(VALUE writer, VALUE name, VALUE value,
|
7
|
+
VALUE isJson);
|
7
8
|
|
8
9
|
VALUE attr_name_for_serialization(Attribute attribute);
|
@@ -1,12 +1,13 @@
|
|
1
1
|
#include "hash.h"
|
2
2
|
|
3
3
|
void hash_attributes_writer(VALUE obj, VALUE attributes,
|
4
|
-
|
4
|
+
EachAttributeFunc write_value, VALUE writer) {
|
5
5
|
long i;
|
6
6
|
for (i = 0; i < RARRAY_LEN(attributes); i++) {
|
7
7
|
volatile VALUE raw_attribute = RARRAY_AREF(attributes, i);
|
8
8
|
Attribute attribute = attribute_read(raw_attribute);
|
9
9
|
|
10
|
-
write_value(writer, attr_name_for_serialization(attribute),
|
10
|
+
write_value(writer, attr_name_for_serialization(attribute),
|
11
|
+
rb_hash_aref(obj, attribute->name_str), Qfalse);
|
11
12
|
}
|
12
13
|
}
|
@@ -7,6 +7,7 @@ void plain_attributes_writer(VALUE obj, VALUE attributes,
|
|
7
7
|
volatile VALUE raw_attribute = RARRAY_AREF(attributes, i);
|
8
8
|
Attribute attribute = attribute_read(raw_attribute);
|
9
9
|
|
10
|
-
write_value(writer, attr_name_for_serialization(attribute),
|
10
|
+
write_value(writer, attr_name_for_serialization(attribute),
|
11
|
+
rb_funcall(obj, attribute->name_id, 0), Qfalse);
|
11
12
|
}
|
12
13
|
}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
#include "type_cast.h"
|
2
|
+
|
2
3
|
#include "time_conversion.h"
|
3
4
|
|
4
5
|
ID deserialize_from_db_id = 0;
|
@@ -212,7 +213,6 @@ bool is_json_type(VALUE type_klass) {
|
|
212
213
|
(ar_json_type != Qundef && type_klass == ar_json_type));
|
213
214
|
}
|
214
215
|
|
215
|
-
|
216
216
|
bool is_boolean_type(VALUE type_klass) { return type_klass == ar_boolean_type; }
|
217
217
|
|
218
218
|
VALUE cast_boolean_type(VALUE value) {
|
@@ -276,26 +276,27 @@ VALUE cast_date_time_type(VALUE value) {
|
|
276
276
|
|
277
277
|
VALUE rescue_func() { return Qfalse; }
|
278
278
|
|
279
|
-
VALUE parse_json(VALUE value) {
|
279
|
+
VALUE parse_json(VALUE value) {
|
280
|
+
return rb_funcall(oj_type, oj_sc_parse_id, 2, rb_cObject, value);
|
281
|
+
}
|
280
282
|
|
281
283
|
VALUE is_json_value(VALUE value) {
|
282
284
|
if (!RB_TYPE_P(value, T_STRING)) {
|
283
285
|
return value;
|
284
286
|
}
|
285
287
|
|
286
|
-
|
287
|
-
if(RSTRING_LEN(value) == 0) {
|
288
|
+
if (RSTRING_LEN(value) == 0) {
|
288
289
|
return Qfalse;
|
289
290
|
}
|
290
291
|
|
291
292
|
volatile VALUE result =
|
292
293
|
rb_rescue2(parse_json, value, rescue_func, Qundef, oj_parseerror_type, 0);
|
293
294
|
|
294
|
-
if(NIL_P(result)) {
|
295
|
+
if (NIL_P(result)) {
|
295
296
|
return Qtrue;
|
296
297
|
}
|
297
298
|
|
298
|
-
if(result == Qfalse) {
|
299
|
+
if (result == Qfalse) {
|
299
300
|
return Qfalse;
|
300
301
|
}
|
301
302
|
|
@@ -323,8 +324,8 @@ VALUE type_cast(VALUE type_metadata, VALUE value, VALUE* isJson) {
|
|
323
324
|
}
|
324
325
|
}
|
325
326
|
|
326
|
-
if(is_json_type(type_klass)) {
|
327
|
-
if(is_json_value(value) == Qfalse) {
|
327
|
+
if (is_json_type(type_klass)) {
|
328
|
+
if (is_json_value(value) == Qfalse) {
|
328
329
|
return Qnil;
|
329
330
|
}
|
330
331
|
*isJson = Qtrue;
|
@@ -357,7 +358,6 @@ void panko_init_type_cast(VALUE mPanko) {
|
|
357
358
|
oj_parseerror_type = rb_const_get_at(oj_type, rb_intern("ParseError"));
|
358
359
|
oj_sc_parse_id = rb_intern("sc_parse");
|
359
360
|
|
360
|
-
|
361
361
|
// TODO: pass 3 arguments here
|
362
362
|
rb_define_singleton_method(mPanko, "_type_cast", public_type_cast, -1);
|
363
363
|
|
@@ -33,7 +33,7 @@ typedef VALUE (*TypeCastFunc)(VALUE value);
|
|
33
33
|
typedef struct _TypeCast {
|
34
34
|
TypeMatchFunc canCast;
|
35
35
|
TypeCastFunc typeCast;
|
36
|
-
}
|
36
|
+
}* TypeCast;
|
37
37
|
|
38
38
|
// ActiveRecord::Type::String
|
39
39
|
// ActiveRecord::Type::Text
|
@@ -76,6 +76,5 @@ void panko_init_type_cast(VALUE mPanko);
|
|
76
76
|
|
77
77
|
// Introduced in ruby 2.4
|
78
78
|
#ifndef RB_INTEGER_TYPE_P
|
79
|
-
#
|
79
|
+
#define RB_INTEGER_TYPE_P(obj) (RB_FIXNUM_P(obj) || RB_TYPE_P(obj, T_BIGNUM))
|
80
80
|
#endif
|
81
|
-
|
@@ -1,7 +1,7 @@
|
|
1
|
-
#include <ruby.h>
|
2
|
-
|
3
1
|
#include "panko_serializer.h"
|
4
2
|
|
3
|
+
#include <ruby.h>
|
4
|
+
|
5
5
|
static ID push_value_id;
|
6
6
|
static ID push_array_id;
|
7
7
|
static ID push_object_id;
|
@@ -16,7 +16,7 @@ static ID serialization_context_id;
|
|
16
16
|
static VALUE SKIP = Qundef;
|
17
17
|
|
18
18
|
void write_value(VALUE str_writer, VALUE key, VALUE value, VALUE isJson) {
|
19
|
-
if(isJson == Qtrue) {
|
19
|
+
if (isJson == Qtrue) {
|
20
20
|
rb_funcall(str_writer, push_json_id, 2, value, key);
|
21
21
|
} else {
|
22
22
|
rb_funcall(str_writer, push_value_id, 2, value, key);
|
@@ -43,7 +43,7 @@ void serialize_method_fields(VALUE object, VALUE str_writer,
|
|
43
43
|
|
44
44
|
volatile VALUE result = rb_funcall(serializer, attribute->name_id, 0);
|
45
45
|
if (result != SKIP) {
|
46
|
-
|
46
|
+
write_value(str_writer, attribute->name_str, result, Qfalse);
|
47
47
|
}
|
48
48
|
}
|
49
49
|
|
@@ -52,10 +52,8 @@ void serialize_method_fields(VALUE object, VALUE str_writer,
|
|
52
52
|
|
53
53
|
void serialize_fields(VALUE object, VALUE str_writer,
|
54
54
|
SerializationDescriptor descriptor) {
|
55
|
-
descriptor->attributes_writer.write_attributes(object,
|
56
|
-
|
57
|
-
write_value,
|
58
|
-
str_writer);
|
55
|
+
descriptor->attributes_writer.write_attributes(object, descriptor->attributes,
|
56
|
+
write_value, str_writer);
|
59
57
|
|
60
58
|
serialize_method_fields(object, str_writer, descriptor);
|
61
59
|
}
|
@@ -77,6 +77,7 @@ VALUE association_decriptor_aset(VALUE self, VALUE descriptor) {
|
|
77
77
|
|
78
78
|
void panko_init_association(VALUE mPanko) {
|
79
79
|
cAssociation = rb_define_class_under(mPanko, "Association", rb_cObject);
|
80
|
+
rb_undef_alloc_func(cAssociation);
|
80
81
|
rb_global_variable(&cAssociation);
|
81
82
|
|
82
83
|
rb_define_module_function(cAssociation, "new", association_new, -1);
|
@@ -85,6 +85,7 @@ void panko_init_attribute(VALUE mPanko) {
|
|
85
85
|
attribute_aliases_id = rb_intern("attribute_aliases");
|
86
86
|
|
87
87
|
cAttribute = rb_define_class_under(mPanko, "Attribute", rb_cObject);
|
88
|
+
rb_undef_alloc_func(cAttribute);
|
88
89
|
rb_global_variable(&cAttribute);
|
89
90
|
|
90
91
|
rb_define_module_function(cAttribute, "new", attribute_new, -1);
|
@@ -16,12 +16,12 @@ typedef struct _Attribute {
|
|
16
16
|
*/
|
17
17
|
VALUE type;
|
18
18
|
VALUE record_class;
|
19
|
-
}
|
19
|
+
}* Attribute;
|
20
20
|
|
21
21
|
Attribute attribute_read(VALUE attribute);
|
22
22
|
void attribute_try_invalidate(Attribute attribute, VALUE new_record_class);
|
23
23
|
void panko_init_attribute(VALUE mPanko);
|
24
24
|
|
25
|
-
#define PANKO_ATTRIBUTE_READ(attribute) (Attribute)DATA_PTR(attribute)
|
25
|
+
#define PANKO_ATTRIBUTE_READ(attribute) (Attribute) DATA_PTR(attribute)
|
26
26
|
|
27
27
|
#endif
|
@@ -49,7 +49,7 @@ SerializationDescriptor sd_read(VALUE descriptor) {
|
|
49
49
|
}
|
50
50
|
|
51
51
|
void sd_set_writer(SerializationDescriptor sd, VALUE object) {
|
52
|
-
if (sd->attributes_writer.object_type !=
|
52
|
+
if (sd->attributes_writer.object_type != UnknownObjectType) {
|
53
53
|
return;
|
54
54
|
}
|
55
55
|
|
data/lib/panko/attribute.rb
CHANGED
@@ -7,9 +7,9 @@ module Panko
|
|
7
7
|
Attribute.new(name.to_s, alias_name)
|
8
8
|
end
|
9
9
|
|
10
|
-
def ==(
|
11
|
-
return name.to_sym ==
|
12
|
-
return name ==
|
10
|
+
def ==(other)
|
11
|
+
return name.to_sym == other if other.is_a? Symbol
|
12
|
+
return name == other.name && alias_name == other.alias_name if other.is_a? Panko::Attribute
|
13
13
|
|
14
14
|
super
|
15
15
|
end
|
@@ -18,8 +18,8 @@ module Panko
|
|
18
18
|
name.to_sym.hash
|
19
19
|
end
|
20
20
|
|
21
|
-
def eql?(
|
22
|
-
self.==(
|
21
|
+
def eql?(other)
|
22
|
+
self.==(other)
|
23
23
|
end
|
24
24
|
|
25
25
|
def inspect
|
data/lib/panko/object_writer.rb
CHANGED
data/lib/panko/response.rb
CHANGED
@@ -75,9 +75,9 @@ module Panko
|
|
75
75
|
|
76
76
|
def write_value(writer, value, key = nil)
|
77
77
|
if value.is_a?(Panko::ArraySerializer) ||
|
78
|
-
|
79
|
-
|
80
|
-
|
78
|
+
value.is_a?(Panko::Serializer) ||
|
79
|
+
value.is_a?(Panko::Response) ||
|
80
|
+
value.is_a?(Panko::JsonValue)
|
81
81
|
writer.push_json(value.to_json, key)
|
82
82
|
else
|
83
83
|
writer.push_value(value, key)
|
@@ -74,7 +74,7 @@ module Panko
|
|
74
74
|
unless has_many_associations.empty?
|
75
75
|
self.has_many_associations = apply_association_filters(
|
76
76
|
has_many_associations,
|
77
|
-
{
|
77
|
+
{attributes: attributes_only_filters, associations: associations_only_filters},
|
78
78
|
attributes: attributes_except_filters, associations: associations_except_filters
|
79
79
|
)
|
80
80
|
end
|
@@ -82,7 +82,7 @@ module Panko
|
|
82
82
|
unless has_one_associations.empty?
|
83
83
|
self.has_one_associations = apply_association_filters(
|
84
84
|
has_one_associations,
|
85
|
-
{
|
85
|
+
{attributes: attributes_only_filters, associations: associations_only_filters},
|
86
86
|
attributes: attributes_except_filters, associations: associations_except_filters
|
87
87
|
)
|
88
88
|
end
|
data/lib/panko/serializer.rb
CHANGED
@@ -75,7 +75,10 @@ module Panko
|
|
75
75
|
|
76
76
|
def has_one(name, options = {})
|
77
77
|
serializer_const = options[:serializer]
|
78
|
-
|
78
|
+
if serializer_const.is_a?(String)
|
79
|
+
serializer_const = Panko::SerializerResolver.resolve(serializer_const, self)
|
80
|
+
end
|
81
|
+
serializer_const ||= Panko::SerializerResolver.resolve(name.to_s, self)
|
79
82
|
|
80
83
|
raise "Can't find serializer for #{self.name}.#{name} has_one relationship." if serializer_const.nil?
|
81
84
|
|
@@ -88,7 +91,10 @@ module Panko
|
|
88
91
|
|
89
92
|
def has_many(name, options = {})
|
90
93
|
serializer_const = options[:serializer] || options[:each_serializer]
|
91
|
-
|
94
|
+
if serializer_const.is_a?(String)
|
95
|
+
serializer_const = Panko::SerializerResolver.resolve(serializer_const, self)
|
96
|
+
end
|
97
|
+
serializer_const ||= Panko::SerializerResolver.resolve(name.to_s, self)
|
92
98
|
|
93
99
|
raise "Can't find serializer for #{self.name}.#{name} has_many relationship." if serializer_const.nil?
|
94
100
|
|
@@ -1,18 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "active_support/core_ext/string/inflections"
|
4
|
+
require "active_support/core_ext/module/introspection"
|
5
5
|
|
6
6
|
class Panko::SerializerResolver
|
7
7
|
class << self
|
8
8
|
def resolve(name, from)
|
9
9
|
serializer_const = nil
|
10
10
|
|
11
|
-
|
11
|
+
namespace = namespace_for(from)
|
12
|
+
|
13
|
+
if namespace.present?
|
12
14
|
serializer_const = safe_serializer_get("#{namespace}::#{name.singularize.camelize}Serializer")
|
13
15
|
end
|
14
16
|
|
15
17
|
serializer_const ||= safe_serializer_get("#{name.singularize.camelize}Serializer")
|
18
|
+
serializer_const ||= safe_serializer_get(name)
|
16
19
|
serializer_const
|
17
20
|
end
|
18
21
|
|
@@ -30,7 +33,7 @@ class Panko::SerializerResolver
|
|
30
33
|
|
31
34
|
def safe_serializer_get(name)
|
32
35
|
const = Object.const_get(name)
|
33
|
-
const < Panko::Serializer ? const : nil
|
36
|
+
(const < Panko::Serializer) ? const : nil
|
34
37
|
rescue NameError
|
35
38
|
nil
|
36
39
|
end
|
data/lib/panko/version.rb
CHANGED
data/panko_serializer.gemspec
CHANGED
@@ -5,14 +5,14 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
require "panko/version"
|
6
6
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
|
-
spec.name
|
9
|
-
spec.version
|
10
|
-
spec.authors
|
11
|
-
spec.email
|
8
|
+
spec.name = "panko_serializer"
|
9
|
+
spec.version = Panko::VERSION
|
10
|
+
spec.authors = ["Yosi Attias"]
|
11
|
+
spec.email = ["yosy101@gmail.com"]
|
12
12
|
|
13
|
-
spec.summary
|
14
|
-
spec.homepage
|
15
|
-
spec.license
|
13
|
+
spec.summary = "High Performance JSON Serialization for ActiveRecord & Ruby Objects"
|
14
|
+
spec.homepage = "https://panko.dev"
|
15
|
+
spec.license = "MIT"
|
16
16
|
|
17
17
|
spec.metadata = {
|
18
18
|
"bug_tracker_uri" => "https://github.com/panko-serializer/panko_serializer/issues",
|
@@ -30,6 +30,6 @@ Gem::Specification.new do |spec|
|
|
30
30
|
|
31
31
|
spec.extensions << "ext/panko_serializer/extconf.rb"
|
32
32
|
|
33
|
-
spec.add_dependency "oj",
|
33
|
+
spec.add_dependency "oj", "> 3.11.0", "< 4.0.0"
|
34
34
|
spec.add_dependency "activesupport"
|
35
35
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: panko_serializer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yosi Attias
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oj
|
@@ -54,10 +54,12 @@ extra_rdoc_files: []
|
|
54
54
|
files:
|
55
55
|
- ".clang-format"
|
56
56
|
- ".github/workflows/docs.yml"
|
57
|
+
- ".github/workflows/lint.yml"
|
57
58
|
- ".github/workflows/ruby.yml"
|
58
59
|
- ".gitignore"
|
59
60
|
- ".rspec"
|
60
61
|
- ".rubocop.yml"
|
62
|
+
- ".standard.yml"
|
61
63
|
- Gemfile
|
62
64
|
- LICENSE.txt
|
63
65
|
- README.md
|
@@ -167,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
169
|
- !ruby/object:Gem::Version
|
168
170
|
version: '0'
|
169
171
|
requirements: []
|
170
|
-
rubygems_version: 3.
|
172
|
+
rubygems_version: 3.3.7
|
171
173
|
signing_key:
|
172
174
|
specification_version: 4
|
173
175
|
summary: High Performance JSON Serialization for ActiveRecord & Ruby Objects
|