alba 0.11.1 → 0.12.0

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: 9aae01860e12e1e5fd71f066e8772fb3a80b4aec6e99cf9dd55ad8652896ea24
4
- data.tar.gz: c9930853dcaaa5ea2ff28e954c3b0d7e2ba559efc64b82e7da6b0c28968f55ed
3
+ metadata.gz: ee2f8d482fedb98083c2acab37b425c7ecedb429ab7bae7698b4eea7949635d9
4
+ data.tar.gz: 1a44f23d425072253ba6743e18c6da9d8fa81de448b58720848c4e9667b12bfb
5
5
  SHA512:
6
- metadata.gz: 7882b0950c339f87fc75b19e79bcdc2481a296331e9be47a646db997fa4db5639af31c49d529063d099cd5df405357d245397af23b0038c568e32feb86bd5718
7
- data.tar.gz: 2bc8c03f0ca5049a23b7dd5c2f6582051f98296a0ba9e0a436e08e9a426a53896e7ac94af276cc3a82e5a0a253f30d381db5384e483c77918ff3d5ef9165a1b7
6
+ metadata.gz: 9bf421fcd99f06cb56499ee31c88dda019e004c58a1880c03326f2a1ce395f7dc4b64be7cee012169c7039530194e85a312b3c53d964b1aaf5288cdf8cb78ae4
7
+ data.tar.gz: 02f20dd839f72f9d2c1859b48470595fff263939f41421e240d74452677edae2dc0569078823984144f630cbc2e6000b6ac3bd0d4161a9ef65bd95dbf311294f
@@ -6,6 +6,7 @@ inherit_gem:
6
6
  require:
7
7
  - rubocop-minitest
8
8
  - rubocop-performance
9
+ - rubocop-rake
9
10
 
10
11
  AllCops:
11
12
  Exclude:
data/Gemfile CHANGED
@@ -6,10 +6,11 @@ gemspec
6
6
  gem 'activesupport', require: false # For backend
7
7
  gem 'coveralls', require: false # For test coverage
8
8
  gem 'minitest', '~> 5.14' # For test
9
- gem 'oj', '~> 3.10', platform: :ruby, require: false # For backend
9
+ gem 'oj', '~> 3.11', platform: :ruby, require: false # For backend
10
10
  gem 'rake', '~> 13.0' # For test and automation
11
11
  gem 'rubocop', '>= 0.79.0', require: false # For lint
12
- gem 'rubocop-minitest', '~> 0.10.1', require: false # For lint
13
- gem 'rubocop-performance', '~> 1.7.1', require: false # For lint
12
+ gem 'rubocop-minitest', '~> 0.10.3', require: false # For lint
13
+ gem 'rubocop-performance', '~> 1.9.2', require: false # For lint
14
+ gem 'rubocop-rake', '>= 0.5.1', require: false # For lint
14
15
  gem 'rubocop-sensible', '~> 0.3.0', require: false # For lint
15
16
  gem 'yard', require: false
@@ -1,19 +1,19 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- alba (0.11.1)
4
+ alba (0.12.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- activesupport (6.0.3.2)
9
+ activesupport (6.1.1)
10
10
  concurrent-ruby (~> 1.0, >= 1.0.2)
11
- i18n (>= 0.7, < 2)
12
- minitest (~> 5.1)
13
- tzinfo (~> 1.1)
14
- zeitwerk (~> 2.2, >= 2.2.2)
11
+ i18n (>= 1.6, < 2)
12
+ minitest (>= 5.1)
13
+ tzinfo (~> 2.0)
14
+ zeitwerk (~> 2.3)
15
15
  ast (2.4.1)
16
- concurrent-ruby (1.1.6)
16
+ concurrent-ruby (1.1.7)
17
17
  coveralls (0.8.23)
18
18
  json (>= 1.8, < 3)
19
19
  simplecov (~> 0.16.1)
@@ -21,36 +21,39 @@ GEM
21
21
  thor (>= 0.19.4, < 2.0)
22
22
  tins (~> 1.6)
23
23
  docile (1.3.2)
24
- i18n (1.8.5)
24
+ i18n (1.8.7)
25
25
  concurrent-ruby (~> 1.0)
26
26
  json (2.3.1)
27
- minitest (5.14.2)
28
- oj (3.10.13)
29
- parallel (1.19.2)
30
- parser (2.7.1.4)
27
+ minitest (5.14.3)
28
+ oj (3.11.0)
29
+ parallel (1.20.1)
30
+ parser (3.0.0.0)
31
31
  ast (~> 2.4.1)
32
32
  rainbow (3.0.0)
33
- rake (13.0.1)
34
- regexp_parser (1.7.1)
33
+ rake (13.0.3)
34
+ regexp_parser (2.0.3)
35
35
  rexml (3.2.4)
36
- rubocop (0.90.0)
36
+ rubocop (1.8.1)
37
37
  parallel (~> 1.10)
38
- parser (>= 2.7.1.1)
38
+ parser (>= 3.0.0.0)
39
39
  rainbow (>= 2.2.2, < 4.0)
40
- regexp_parser (>= 1.7)
40
+ regexp_parser (>= 1.8, < 3.0)
41
41
  rexml
42
- rubocop-ast (>= 0.3.0, < 1.0)
42
+ rubocop-ast (>= 1.2.0, < 2.0)
43
43
  ruby-progressbar (~> 1.7)
44
- unicode-display_width (>= 1.4.0, < 2.0)
45
- rubocop-ast (0.3.0)
46
- parser (>= 2.7.1.4)
47
- rubocop-minitest (0.10.1)
48
- rubocop (>= 0.87)
49
- rubocop-performance (1.7.1)
50
- rubocop (>= 0.82.0)
44
+ unicode-display_width (>= 1.4.0, < 3.0)
45
+ rubocop-ast (1.4.0)
46
+ parser (>= 2.7.1.5)
47
+ rubocop-minitest (0.10.3)
48
+ rubocop (>= 0.87, < 2.0)
49
+ rubocop-performance (1.9.2)
50
+ rubocop (>= 0.90.0, < 2.0)
51
+ rubocop-ast (>= 0.4.0)
52
+ rubocop-rake (0.5.1)
53
+ rubocop
51
54
  rubocop-sensible (0.3.0)
52
55
  rubocop (>= 0.60.0)
53
- ruby-progressbar (1.10.1)
56
+ ruby-progressbar (1.11.0)
54
57
  simplecov (0.16.1)
55
58
  docile (~> 1.1)
56
59
  json (>= 1.8, < 3)
@@ -60,14 +63,13 @@ GEM
60
63
  term-ansicolor (1.7.1)
61
64
  tins (~> 1.0)
62
65
  thor (1.0.1)
63
- thread_safe (0.3.6)
64
66
  tins (1.25.0)
65
67
  sync
66
- tzinfo (1.2.7)
67
- thread_safe (~> 0.1)
68
- unicode-display_width (1.7.0)
69
- yard (0.9.25)
70
- zeitwerk (2.4.0)
68
+ tzinfo (2.0.4)
69
+ concurrent-ruby (~> 1.0)
70
+ unicode-display_width (2.0.0)
71
+ yard (0.9.26)
72
+ zeitwerk (2.4.2)
71
73
 
72
74
  PLATFORMS
73
75
  ruby
@@ -77,13 +79,14 @@ DEPENDENCIES
77
79
  alba!
78
80
  coveralls
79
81
  minitest (~> 5.14)
80
- oj (~> 3.10)
82
+ oj (~> 3.11)
81
83
  rake (~> 13.0)
82
84
  rubocop (>= 0.79.0)
83
- rubocop-minitest (~> 0.10.1)
84
- rubocop-performance (~> 1.7.1)
85
+ rubocop-minitest (~> 0.10.3)
86
+ rubocop-performance (~> 1.9.2)
87
+ rubocop-rake (>= 0.5.1)
85
88
  rubocop-sensible (~> 0.3.0)
86
89
  yard
87
90
 
88
91
  BUNDLED WITH
89
- 2.1.4
92
+ 2.2.6
@@ -6,6 +6,7 @@ require_relative 'alba/resource'
6
6
  module Alba
7
7
  # Base class for Errors
8
8
  class Error < StandardError; end
9
+
9
10
  # Error class for backend which is not supported
10
11
  class UnsupportedBackend < Error; end
11
12
 
@@ -78,9 +79,9 @@ module Alba
78
79
 
79
80
  def resource_class
80
81
  @resource_class ||= begin
81
- klass = Class.new
82
- klass.include(Alba::Resource)
83
- end
82
+ klass = Class.new
83
+ klass.include(Alba::Resource)
84
+ end
84
85
  end
85
86
  end
86
87
 
@@ -141,6 +141,7 @@ module Alba
141
141
  def one(name, condition = nil, resource: nil, key: nil, &block)
142
142
  @_attributes[key&.to_sym || name.to_sym] = One.new(name: name, condition: condition, resource: resource, &block)
143
143
  end
144
+ alias has_one one
144
145
 
145
146
  # Set Many association
146
147
  #
@@ -153,6 +154,7 @@ module Alba
153
154
  def many(name, condition = nil, resource: nil, key: nil, &block)
154
155
  @_attributes[key&.to_sym || name.to_sym] = Many.new(name: name, condition: condition, resource: resource, &block)
155
156
  end
157
+ alias has_many many
156
158
 
157
159
  # Set serializer for the resource
158
160
  #
@@ -23,7 +23,9 @@ module Alba
23
23
  @hash = resource.serializable_hash
24
24
  @hash = {key.to_sym => @hash} if key
25
25
  # @hash is either Hash or Array
26
- @hash.is_a?(Hash) ? @hash.merge!(metadata.to_h) : @hash << metadata
26
+ unless metadata.empty?
27
+ @hash.is_a?(Hash) ? @hash.merge!(metadata.to_h) : @hash << metadata
28
+ end
27
29
  end
28
30
 
29
31
  # Use real encoder to actually serialize to JSON
@@ -1,3 +1,3 @@
1
1
  module Alba
2
- VERSION = '0.11.1'.freeze
2
+ VERSION = '0.12.0'.freeze
3
3
  end
data/sider.yml CHANGED
@@ -7,6 +7,7 @@ linter:
7
7
  - "rubocop-minitest"
8
8
  - "rubocop-performance"
9
9
  - "rubocop-sensible"
10
+ - "rubocop-rake"
10
11
  safe: false
11
12
 
12
13
  # # https://help.sider.review/tools/ruby/reek
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alba
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.1
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OKURA Masafumi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-02 00:00:00.000000000 Z
11
+ date: 2021-01-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Alba is designed to be a simple, easy to use and fast alternative to
14
14
  existing JSON serializers. Its performance is better than almost all gems which
@@ -62,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
62
  - !ruby/object:Gem::Version
63
63
  version: '0'
64
64
  requirements: []
65
- rubygems_version: 3.1.4
65
+ rubygems_version: 3.0.3
66
66
  signing_key:
67
67
  specification_version: 4
68
68
  summary: Alba is the fastest JSON serializer for Ruby.