cinnamon_serial 1.0.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +0 -14
- data/Gemfile.lock +1 -1
- data/lib/cinnamon_serial/dsl.rb +0 -2
- data/lib/cinnamon_serial/resolver.rb +0 -10
- data/lib/cinnamon_serial/version.rb +1 -1
- data/spec/base_spec.rb +0 -4
- data/spec/dsl_spec.rb +0 -2
- data/spec/examples.rb +3 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc99c26bd3ac755f7bc43b101f399f62ee21162f
|
4
|
+
data.tar.gz: 8cbf16165c228458d3acf6793d648ceb361a658b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 292175294b5a88a7d56d4f30ebf3854a69c4662c32f5d78d2acf5f4e0e534f2361a486f54dff4ca16258066e83b549805e25504175ece222e4dc9bfae92a9296
|
7
|
+
data.tar.gz: 7788ac0567c1cfbfb097f103785ae7b492ea728ba170c819fa81877fd56c0d27d9eab1bf5418534a758a40084b35c0b968afe68dde7cad59d3b5835cd4b32168
|
data/.rubocop_todo.yml
CHANGED
@@ -6,20 +6,6 @@
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count: 2
|
10
|
-
# Cop supports --auto-correct.
|
11
|
-
# Configuration parameters: EnforcedStyle.
|
12
|
-
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only
|
13
|
-
Layout/EmptyLinesAroundClassBody:
|
14
|
-
Exclude:
|
15
|
-
- 'spec/examples.rb'
|
16
|
-
|
17
|
-
# Offense count: 4
|
18
|
-
Lint/BooleanSymbol:
|
19
|
-
Exclude:
|
20
|
-
- 'lib/cinnamon_serial/resolver.rb'
|
21
|
-
- 'spec/examples.rb'
|
22
|
-
|
23
9
|
# Offense count: 4
|
24
10
|
Metrics/AbcSize:
|
25
11
|
Max: 26
|
data/Gemfile.lock
CHANGED
data/lib/cinnamon_serial/dsl.rb
CHANGED
@@ -12,8 +12,6 @@ module CinnamonSerial
|
|
12
12
|
class Resolver
|
13
13
|
attr_accessor :as,
|
14
14
|
:blank,
|
15
|
-
# <b>DEPRECATED:</b> Please use <tt>false_alias</tt> instead.
|
16
|
-
:false,
|
17
15
|
:false_alias,
|
18
16
|
:for,
|
19
17
|
:manual,
|
@@ -26,8 +24,6 @@ module CinnamonSerial
|
|
26
24
|
:present,
|
27
25
|
:through,
|
28
26
|
:transform,
|
29
|
-
# <b>DEPRECATED:</b> Please use <tt>true_alias</tt> instead.
|
30
|
-
:true,
|
31
27
|
:true_alias
|
32
28
|
|
33
29
|
def initialize(options = {})
|
@@ -91,14 +87,8 @@ module CinnamonSerial
|
|
91
87
|
def resolve_alias(value)
|
92
88
|
if @option_keys.include?('true_alias') && value.is_a?(TrueClass)
|
93
89
|
true_alias
|
94
|
-
# <b>DEPRECATED:</b> Please use <tt>true_alias</tt> instead.
|
95
|
-
elsif @option_keys.include?('true') && value.is_a?(TrueClass)
|
96
|
-
self.true
|
97
90
|
elsif @option_keys.include?('false_alias') && value.is_a?(FalseClass)
|
98
91
|
false_alias
|
99
|
-
# <b>DEPRECATED:</b> Please use <tt>false_alias</tt> instead.
|
100
|
-
elsif @option_keys.include?('false') && value.is_a?(FalseClass)
|
101
|
-
self.false
|
102
92
|
elsif @option_keys.include?('null') && value.nil?
|
103
93
|
null
|
104
94
|
elsif @option_keys.include?('blank') && Formatting.blank?(value)
|
data/spec/base_spec.rb
CHANGED
@@ -24,9 +24,7 @@ describe CinnamonSerial::Base do
|
|
24
24
|
manager_name
|
25
25
|
renewal_date
|
26
26
|
notify_date
|
27
|
-
true_value
|
28
27
|
true_alias_value
|
29
|
-
false_value
|
30
28
|
false_alias_value
|
31
29
|
null
|
32
30
|
present
|
@@ -96,9 +94,7 @@ describe CinnamonSerial::Base do
|
|
96
94
|
expect(data['renewal_date']).to eq(matt.start_date + (60 * 60 * 24 * 24))
|
97
95
|
expect(data['notify_date']).to eq(matt.start_date + (60 * 60 * 24 * 23))
|
98
96
|
|
99
|
-
expect(data['true_value']).to eq('I am true.')
|
100
97
|
expect(data['true_alias_value']).to eq('I am true alias.')
|
101
|
-
expect(data['false_value']).to eq('I am false.')
|
102
98
|
expect(data['false_alias_value']).to eq('I am false alias.')
|
103
99
|
expect(data['null']).to eq('I am null.')
|
104
100
|
expect(data['present']).to eq('I am present.')
|
data/spec/dsl_spec.rb
CHANGED
data/spec/examples.rb
CHANGED
@@ -93,15 +93,9 @@ class EmployeeListSerializer < CinnamonSerial::Base
|
|
93
93
|
serialize :notify_date, for: :start_date, transform: :notification_date
|
94
94
|
|
95
95
|
# Test 'true' alias
|
96
|
-
|
97
|
-
# <b>DEPRECATED:</b> Please use <tt>true_alias</tt> instead.
|
98
|
-
serialize :true_value, true: 'I am true.'
|
99
96
|
serialize :true_alias_value, true_alias: 'I am true alias.'
|
100
97
|
|
101
98
|
# Test 'false' alias
|
102
|
-
|
103
|
-
# <b>DEPRECATED:</b> Please use <tt>false_alias</tt> instead.
|
104
|
-
serialize :false_value, false: 'I am false.'
|
105
99
|
serialize :false_alias_value, false_alias: 'I am false alias.'
|
106
100
|
|
107
101
|
# Test 'null' alias
|
@@ -160,10 +154,10 @@ end
|
|
160
154
|
# Subclass to test inheritance.
|
161
155
|
# #############################
|
162
156
|
class EmployeeSerializer < EmployeeListSerializer
|
163
|
-
|
157
|
+
serialize :start_date, :job
|
164
158
|
|
165
|
-
|
166
|
-
|
159
|
+
serialize :founder,
|
160
|
+
:owner, manual: true
|
167
161
|
|
168
162
|
hydrate do
|
169
163
|
set_founder(obj.id < 10)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cinnamon_serial
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Ruggio
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|