panko_serializer 0.4.0 → 0.4.2

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: 7cd2e60ecfb8f4fd8557aa148cbd981d0552e72e40678e36168b494e31a426a9
4
- data.tar.gz: 302d629080ee255fc8ae3117ec169a1f9db35c1e9ff4c598b9cad5a8f9830a9b
3
+ metadata.gz: 392d44930b3cd861d45c08e3f8092b55c84550525ced57fcd59d0425827ab177
4
+ data.tar.gz: bd30319fd499a26b1a44943e443f2f145b1969632fb1aa51472ace7f2d7e21a9
5
5
  SHA512:
6
- metadata.gz: 53bdb412d51f9aaf0ab7d0bd7065117257f28cf6b468a51761d7bb8a4582d2d69b9105e02de65ec0964ddefdd158d169c821f50f03ae46f9a6a4243a9b5035b3
7
- data.tar.gz: 86eae7fb5ecda7ae0d356d24cabf557d99bf817577b4b3a45a1f4fcbc5120f54bb2eece291e356047d42857af69c24e5870b6fdae45308881c6c4619241a1961
6
+ metadata.gz: 811ed00b96b5a2dbc527b912c77f1f44576586b04de6366fd5c9a8d2a80f9f411a0ab22a5db87a9a3fa3129596cd94bfc6ac5fd2f7ac66725819612e97aa373f
7
+ data.tar.gz: dd894089a01e61a25da591725ac9cbb6be5e8de188a17a100f8d18bdedf787161d3c4e16263b91e5b1cbcd9eadb09f50576fe53aa3ffa0e544e5fa325c0ee565
data/Gemfile CHANGED
@@ -29,4 +29,7 @@ end
29
29
 
30
30
  group :development do
31
31
  gem "byebug"
32
+ gem "rake"
33
+ gem "rspec", "~> 3.0"
34
+ gem "rake-compiler"
32
35
  end
@@ -239,17 +239,30 @@ VALUE cast_boolean_type(VALUE value) {
239
239
  return value;
240
240
  }
241
241
 
242
- if (value == Qnil || RSTRING_LEN(value) == 0) {
242
+ if (value == Qnil) {
243
243
  return Qnil;
244
244
  }
245
245
 
246
- const char* val = StringValuePtr(value);
247
- bool isFalseValue =
248
- (*val == '0' || (*val == 'f' || *val == 'F') ||
249
- (strcmp(val, "false") == 0 || strcmp(val, "FALSE") == 0) ||
250
- (strcmp(val, "off") == 0 || strcmp(val, "OFF") == 0));
246
+ if(RB_TYPE_P(value, T_STRING)) {
247
+ if(RSTRING_LEN(value) == 0) {
248
+ return Qnil;
249
+ }
250
+
251
+ const char* val = StringValuePtr(value);
252
+
253
+ bool isFalseValue =
254
+ (*val == '0' || (*val == 'f' || *val == 'F') ||
255
+ (strcmp(val, "false") == 0 || strcmp(val, "FALSE") == 0) ||
256
+ (strcmp(val, "off") == 0 || strcmp(val, "OFF") == 0));
251
257
 
252
- return isFalseValue ? Qfalse : Qtrue;
258
+ return isFalseValue ? Qfalse : Qtrue;
259
+ }
260
+
261
+ if (RB_INTEGER_TYPE_P(value)) {
262
+ return value == INT2NUM(1) ? Qtrue : Qfalse;
263
+ }
264
+
265
+ return Qnil;
253
266
  }
254
267
 
255
268
  bool is_date_time_type(VALUE type_klass) {
data/lib/panko/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Panko
3
- VERSION = "0.4.0"
3
+ VERSION = "0.4.2"
4
4
  end
@@ -21,10 +21,5 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.extensions << "ext/panko_serializer/extconf.rb"
23
23
 
24
- spec.add_development_dependency "bundler", "~> 1.14"
25
- spec.add_development_dependency "rake", "~> 10.5"
26
- spec.add_development_dependency "rspec", "~> 3.0"
27
- spec.add_development_dependency "rake-compiler"
28
-
29
24
  spec.add_dependency "oj", "~> 3.6.0"
30
25
  end
metadata CHANGED
@@ -1,71 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: panko_serializer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yosi Attias
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-04 00:00:00.000000000 Z
11
+ date: 2018-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.14'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.14'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '10.5'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '10.5'
41
- - !ruby/object:Gem::Dependency
42
- name: rspec
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '3.0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '3.0'
55
- - !ruby/object:Gem::Dependency
56
- name: rake-compiler
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
13
  - !ruby/object:Gem::Dependency
70
14
  name: oj
71
15
  requirement: !ruby/object:Gem::Requirement
@@ -171,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
115
  version: '0'
172
116
  requirements: []
173
117
  rubyforge_project:
174
- rubygems_version: 2.7.6
118
+ rubygems_version: 2.7.7
175
119
  signing_key:
176
120
  specification_version: 4
177
121
  summary: Fast serialization for ActiveModel