smart_value-object 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -1
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +65 -62
- data/README.md +35 -6
- data/bin/console +3 -3
- data/lib/smart_core/value_object/interface/comparable.rb +2 -0
- data/lib/smart_core/value_object/interface/enumerable.rb +2 -0
- data/lib/smart_core/value_object/version.rb +3 -1
- data/smart_value-object.gemspec +5 -5
- metadata +16 -17
- data/.travis.yml +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c060fc01a4d946c597ce5074bf7d15867ed4c26f4ecf72bf8ba8bb81db322eb
|
4
|
+
data.tar.gz: bf7dac9f80ba8d05b3d351aabef40026663b2b1998c140429047cf25d1c4c043
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13d584c3b89dc4275fb3c9bedd3ce19645bbead9be0bd81543488693119b80b6fbe9190fecdb56bcdf1d46ea51b2dbd31adb714cffd5d25f8c2c0d74ff0e6538
|
7
|
+
data.tar.gz: 7c9d95b46429ab41c70a00fc9f18f79c24e6f2f2108958d1fda1f895b624199761ce20659412437130f2176f376069b510df99800c8ea0d30a24c9c7ce522dd4
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Changelog
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
+
## [0.2.0] - 2021-01-18
|
5
|
+
### Added
|
6
|
+
- Support for **Ruby@3**;
|
7
|
+
|
8
|
+
### Changed
|
9
|
+
- No more `TravisCI` (TODO: migrate to `GitHub Actions`);
|
10
|
+
- Updated development dependencies;
|
11
|
+
- Updated `smart_initializer` dependency (`~> 0.5`) to guarantee **Ruby3** compatability;
|
12
|
+
|
4
13
|
## [0.1.0] - 2020-07-12
|
5
14
|
- Release :)
|
data/Gemfile.lock
CHANGED
@@ -2,107 +2,110 @@ PATH
|
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
4
|
smart_value-object (0.1.0)
|
5
|
-
smart_initializer (~> 0.
|
5
|
+
smart_initializer (~> 0.5)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activesupport (6.
|
10
|
+
activesupport (6.1.1)
|
11
11
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
|
-
i18n (>=
|
13
|
-
minitest (
|
14
|
-
tzinfo (~>
|
15
|
-
zeitwerk (~> 2.
|
16
|
-
armitage-rubocop (0.
|
17
|
-
rubocop (=
|
18
|
-
rubocop-performance (= 1.
|
19
|
-
rubocop-rails (= 2.
|
12
|
+
i18n (>= 1.6, < 2)
|
13
|
+
minitest (>= 5.1)
|
14
|
+
tzinfo (~> 2.0)
|
15
|
+
zeitwerk (~> 2.3)
|
16
|
+
armitage-rubocop (1.7.0.1)
|
17
|
+
rubocop (= 1.7.0)
|
18
|
+
rubocop-performance (= 1.9.1)
|
19
|
+
rubocop-rails (= 2.9.1)
|
20
20
|
rubocop-rake (= 0.5.1)
|
21
|
-
rubocop-rspec (= 1.
|
21
|
+
rubocop-rspec (= 2.1.0)
|
22
22
|
ast (2.4.1)
|
23
23
|
coderay (1.1.3)
|
24
|
-
concurrent-ruby (1.1.
|
24
|
+
concurrent-ruby (1.1.7)
|
25
25
|
diff-lcs (1.4.4)
|
26
|
-
docile (1.3.
|
27
|
-
i18n (1.8.
|
26
|
+
docile (1.3.5)
|
27
|
+
i18n (1.8.7)
|
28
28
|
concurrent-ruby (~> 1.0)
|
29
29
|
method_source (1.0.0)
|
30
|
-
minitest (5.14.
|
31
|
-
parallel (1.
|
32
|
-
parser (
|
30
|
+
minitest (5.14.3)
|
31
|
+
parallel (1.20.1)
|
32
|
+
parser (3.0.0.0)
|
33
33
|
ast (~> 2.4.1)
|
34
34
|
pry (0.13.1)
|
35
35
|
coderay (~> 1.1)
|
36
36
|
method_source (~> 1.0)
|
37
|
-
qonfig (0.
|
37
|
+
qonfig (0.25.0)
|
38
38
|
rack (2.2.3)
|
39
39
|
rainbow (3.0.0)
|
40
|
-
rake (13.0.
|
41
|
-
regexp_parser (
|
40
|
+
rake (13.0.3)
|
41
|
+
regexp_parser (2.0.3)
|
42
42
|
rexml (3.2.4)
|
43
|
-
rspec (3.
|
44
|
-
rspec-core (~> 3.
|
45
|
-
rspec-expectations (~> 3.
|
46
|
-
rspec-mocks (~> 3.
|
47
|
-
rspec-core (3.
|
48
|
-
rspec-support (~> 3.
|
49
|
-
rspec-expectations (3.
|
43
|
+
rspec (3.10.0)
|
44
|
+
rspec-core (~> 3.10.0)
|
45
|
+
rspec-expectations (~> 3.10.0)
|
46
|
+
rspec-mocks (~> 3.10.0)
|
47
|
+
rspec-core (3.10.1)
|
48
|
+
rspec-support (~> 3.10.0)
|
49
|
+
rspec-expectations (3.10.1)
|
50
50
|
diff-lcs (>= 1.2.0, < 2.0)
|
51
|
-
rspec-support (~> 3.
|
52
|
-
rspec-mocks (3.
|
51
|
+
rspec-support (~> 3.10.0)
|
52
|
+
rspec-mocks (3.10.1)
|
53
53
|
diff-lcs (>= 1.2.0, < 2.0)
|
54
|
-
rspec-support (~> 3.
|
55
|
-
rspec-support (3.
|
56
|
-
rubocop (
|
54
|
+
rspec-support (~> 3.10.0)
|
55
|
+
rspec-support (3.10.1)
|
56
|
+
rubocop (1.7.0)
|
57
57
|
parallel (~> 1.10)
|
58
|
-
parser (>= 2.7.1.
|
58
|
+
parser (>= 2.7.1.5)
|
59
59
|
rainbow (>= 2.2.2, < 4.0)
|
60
|
-
regexp_parser (>= 1.
|
60
|
+
regexp_parser (>= 1.8, < 3.0)
|
61
61
|
rexml
|
62
|
-
rubocop-ast (>=
|
62
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
63
63
|
ruby-progressbar (~> 1.7)
|
64
64
|
unicode-display_width (>= 1.4.0, < 2.0)
|
65
|
-
rubocop-ast (
|
66
|
-
parser (>= 2.7.
|
67
|
-
rubocop-performance (1.
|
68
|
-
rubocop (>= 0.
|
69
|
-
|
65
|
+
rubocop-ast (1.4.0)
|
66
|
+
parser (>= 2.7.1.5)
|
67
|
+
rubocop-performance (1.9.1)
|
68
|
+
rubocop (>= 0.90.0, < 2.0)
|
69
|
+
rubocop-ast (>= 0.4.0)
|
70
|
+
rubocop-rails (2.9.1)
|
70
71
|
activesupport (>= 4.2.0)
|
71
72
|
rack (>= 1.1)
|
72
|
-
rubocop (>= 0.
|
73
|
+
rubocop (>= 0.90.0, < 2.0)
|
73
74
|
rubocop-rake (0.5.1)
|
74
75
|
rubocop
|
75
|
-
rubocop-rspec (1.
|
76
|
-
rubocop (
|
77
|
-
|
78
|
-
|
76
|
+
rubocop-rspec (2.1.0)
|
77
|
+
rubocop (~> 1.0)
|
78
|
+
rubocop-ast (>= 1.1.0)
|
79
|
+
ruby-progressbar (1.11.0)
|
80
|
+
simplecov (0.21.2)
|
79
81
|
docile (~> 1.1)
|
80
82
|
simplecov-html (~> 0.11)
|
81
|
-
|
82
|
-
|
83
|
-
|
83
|
+
simplecov_json_formatter (~> 0.1)
|
84
|
+
simplecov-html (0.12.3)
|
85
|
+
simplecov_json_formatter (0.1.2)
|
86
|
+
smart_engine (0.11.0)
|
87
|
+
smart_initializer (0.5.0)
|
84
88
|
qonfig (~> 0.24)
|
85
|
-
smart_engine (~> 0.
|
86
|
-
smart_types (~> 0.
|
87
|
-
smart_types (0.
|
88
|
-
smart_engine (~> 0.
|
89
|
-
|
90
|
-
|
91
|
-
thread_safe (~> 0.1)
|
89
|
+
smart_engine (~> 0.11)
|
90
|
+
smart_types (~> 0.4)
|
91
|
+
smart_types (0.4.0)
|
92
|
+
smart_engine (~> 0.11)
|
93
|
+
tzinfo (2.0.4)
|
94
|
+
concurrent-ruby (~> 1.0)
|
92
95
|
unicode-display_width (1.7.0)
|
93
|
-
zeitwerk (2.
|
96
|
+
zeitwerk (2.4.2)
|
94
97
|
|
95
98
|
PLATFORMS
|
96
|
-
|
99
|
+
x86_64-darwin-20
|
97
100
|
|
98
101
|
DEPENDENCIES
|
99
|
-
armitage-rubocop (~>
|
100
|
-
bundler (~> 2.
|
102
|
+
armitage-rubocop (~> 1.7)
|
103
|
+
bundler (~> 2.2)
|
101
104
|
pry (~> 0.13)
|
102
105
|
rake (~> 13.0)
|
103
|
-
rspec (~> 3.
|
104
|
-
simplecov (~> 0.
|
106
|
+
rspec (~> 3.10)
|
107
|
+
simplecov (~> 0.21)
|
105
108
|
smart_value-object!
|
106
109
|
|
107
110
|
BUNDLED WITH
|
108
|
-
2.
|
111
|
+
2.2.3
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# SmartCore::ValueObject · [![Gem Version](https://badge.fury.io/rb/smart_value-object.svg)](https://badge.fury.io/rb/smart_value-object)
|
1
|
+
# SmartCore::ValueObject · [![Gem Version](https://badge.fury.io/rb/smart_value-object.svg)](https://badge.fury.io/rb/smart_value-object)
|
2
2
|
|
3
3
|
Value Object pattern realized in scope of Ruby.
|
4
4
|
|
@@ -39,10 +39,10 @@ require 'smart_core/value-object'
|
|
39
39
|
|
40
40
|
```ruby
|
41
41
|
class Address < SmartCore::ValueObject
|
42
|
-
attribute :country, 'string'
|
43
|
-
attribute :city, 'string'
|
44
|
-
property :location, 'string'
|
45
|
-
property :capital,
|
42
|
+
attribute :country, 'value.string' # an alias of SmartCore::Types::Value::String (see smart_initializer gem)
|
43
|
+
attribute :city, 'value.string'
|
44
|
+
property :location, 'value.string'
|
45
|
+
property :capital, SmartCore::Types::Value::Boolean
|
46
46
|
end
|
47
47
|
|
48
48
|
khabarovsk = Address.new('Russia', 'Khabaovsk', location: '48.4814/135.0721', capital: false)
|
@@ -70,7 +70,7 @@ khabarovsk.to_h # or #as_hash or #to_hash
|
|
70
70
|
```ruby
|
71
71
|
# comparability:
|
72
72
|
khabarovsk == same_city # => true
|
73
|
-
khabarovsk == another_city # false
|
73
|
+
khabarovsk == another_city # => false
|
74
74
|
```
|
75
75
|
|
76
76
|
```ruby
|
@@ -79,6 +79,35 @@ khabarovsk.to_a # => [khabarovsk]
|
|
79
79
|
khabarovsk.each { |entity| puts entity } # => outputs itself
|
80
80
|
```
|
81
81
|
|
82
|
+
---
|
83
|
+
|
84
|
+
## Roadmap
|
85
|
+
|
86
|
+
- Migrate to `GitHub Actions`;
|
87
|
+
|
88
|
+
---
|
89
|
+
|
90
|
+
## Build
|
91
|
+
|
92
|
+
- run tests:
|
93
|
+
|
94
|
+
```shell
|
95
|
+
bundle exec rspec
|
96
|
+
```
|
97
|
+
|
98
|
+
- run code style checks:
|
99
|
+
|
100
|
+
```shell
|
101
|
+
bundle exec rubocop
|
102
|
+
```
|
103
|
+
|
104
|
+
- run code style checks with auto-correction:
|
105
|
+
|
106
|
+
```shell
|
107
|
+
bundle exec rubocop -A
|
108
|
+
```
|
109
|
+
|
110
|
+
|
82
111
|
---
|
83
112
|
|
84
113
|
## Contributing
|
data/bin/console
CHANGED
@@ -59,6 +59,7 @@ module SmartCore::ValueObject::Interface::Comparable
|
|
59
59
|
#
|
60
60
|
# @api public
|
61
61
|
# @since 0.1.0
|
62
|
+
# rubocop:disable Style/RedundantSelf
|
62
63
|
def eql?(another_object)
|
63
64
|
self.class <= another_object.class && (
|
64
65
|
self.class.__params__.all? do |attribute|
|
@@ -71,5 +72,6 @@ module SmartCore::ValueObject::Interface::Comparable
|
|
71
72
|
)
|
72
73
|
end
|
73
74
|
alias_method :==, :eql?
|
75
|
+
# rubocop:enable Style/RedundantSelf
|
74
76
|
end
|
75
77
|
end
|
@@ -23,8 +23,10 @@ module SmartCore::ValueObject::Interface::Enumerable
|
|
23
23
|
#
|
24
24
|
# @api public
|
25
25
|
# @since 0.1.0
|
26
|
+
# rubocop:disable Style/RedundantParentheses
|
26
27
|
def each(&block)
|
27
28
|
block_given? ? yield(self) : (Enumerator.new { |yielder| yielder.yield(self) }.each)
|
28
29
|
end
|
30
|
+
# rubocop:enable Style/RedundantParentheses
|
29
31
|
end
|
30
32
|
end
|
@@ -1,11 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module SmartCore
|
4
|
+
# rubocop:disable Style/StaticClass
|
4
5
|
class ValueObject
|
5
6
|
# @return [String]
|
6
7
|
#
|
7
8
|
# @api public
|
8
9
|
# @since 0.1.0
|
9
|
-
VERSION = '0.
|
10
|
+
VERSION = '0.2.0'
|
10
11
|
end
|
12
|
+
# rubocop:enable Style/StaticClass
|
11
13
|
end
|
data/smart_value-object.gemspec
CHANGED
@@ -30,12 +30,12 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
31
|
spec.require_paths = ['lib']
|
32
32
|
|
33
|
-
spec.add_runtime_dependency 'smart_initializer', '~> 0.
|
33
|
+
spec.add_runtime_dependency 'smart_initializer', '~> 0.5'
|
34
34
|
|
35
|
-
spec.add_development_dependency 'armitage-rubocop', '~>
|
36
|
-
spec.add_development_dependency 'bundler', '~> 2.
|
35
|
+
spec.add_development_dependency 'armitage-rubocop', '~> 1.7'
|
36
|
+
spec.add_development_dependency 'bundler', '~> 2.2'
|
37
37
|
spec.add_development_dependency 'pry', '~> 0.13'
|
38
38
|
spec.add_development_dependency 'rake', '~> 13.0'
|
39
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
40
|
-
spec.add_development_dependency 'simplecov', '~> 0.
|
39
|
+
spec.add_development_dependency 'rspec', '~> 3.10'
|
40
|
+
spec.add_development_dependency 'simplecov', '~> 0.21'
|
41
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_value-object
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rustam Ibragimov
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: smart_initializer
|
@@ -16,42 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.5'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.5'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: armitage-rubocop
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '1.7'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '1.7'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '2.
|
47
|
+
version: '2.2'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '2.
|
54
|
+
version: '2.2'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: pry
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,28 +86,28 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '3.
|
89
|
+
version: '3.10'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '3.
|
96
|
+
version: '3.10'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: simplecov
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0.
|
103
|
+
version: '0.21'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '0.
|
110
|
+
version: '0.21'
|
111
111
|
description: ValueObject pattern realized in scope of Ruby.
|
112
112
|
email:
|
113
113
|
- iamdaiver@gmail.com
|
@@ -118,7 +118,6 @@ files:
|
|
118
118
|
- ".gitignore"
|
119
119
|
- ".rspec"
|
120
120
|
- ".rubocop.yml"
|
121
|
-
- ".travis.yml"
|
122
121
|
- CHANGELOG.md
|
123
122
|
- CODE_OF_CONDUCT.md
|
124
123
|
- Gemfile
|
@@ -144,7 +143,7 @@ metadata:
|
|
144
143
|
homepage_uri: https://github.com/smart-rb/smart_value-object
|
145
144
|
source_code_uri: https://github.com/smart-rb/smart_value-object
|
146
145
|
changelog_uri: https://github.com/smart-rb/smart_value-object/blob/master/CHANGELOG.md
|
147
|
-
post_install_message:
|
146
|
+
post_install_message:
|
148
147
|
rdoc_options: []
|
149
148
|
require_paths:
|
150
149
|
- lib
|
@@ -159,8 +158,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
158
|
- !ruby/object:Gem::Version
|
160
159
|
version: '0'
|
161
160
|
requirements: []
|
162
|
-
rubygems_version: 3.
|
163
|
-
signing_key:
|
161
|
+
rubygems_version: 3.2.3
|
162
|
+
signing_key:
|
164
163
|
specification_version: 4
|
165
164
|
summary: ValueObject pattern realized in scope of Ruby.
|
166
165
|
test_files: []
|
data/.travis.yml
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
---
|
2
|
-
language: ruby
|
3
|
-
cache: bundler
|
4
|
-
os: linux
|
5
|
-
dist: xenial
|
6
|
-
jobs:
|
7
|
-
fast_finish: true
|
8
|
-
include:
|
9
|
-
- rvm: 2.4.10
|
10
|
-
- rvm: 2.5.8
|
11
|
-
- rvm: 2.6.6
|
12
|
-
- rvm: 2.7.1
|
13
|
-
- rvm: jruby-head
|
14
|
-
- rvm: ruby-head
|
15
|
-
- rvm: truffleruby
|
16
|
-
allow_failures:
|
17
|
-
- rvm: ruby-head
|
18
|
-
- rvm: jruby-head
|
19
|
-
- rvm: truffleruby
|
20
|
-
before_install: gem install bundler
|
21
|
-
script:
|
22
|
-
- bundle exec rake rubocop
|
23
|
-
- bundle exec rake rspec
|