valued 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +35 -0
- data/.gitignore +2 -0
- data/.tool-versions +2 -0
- data/CHANGELOG.md +9 -2
- data/Gemfile.lock +3 -3
- data/lib/valued.rb +9 -9
- data/lib/valued/mutable.rb +10 -10
- data/lib/valued/version.rb +1 -1
- data/package-lock.json +51 -0
- data/package.json +12 -0
- data/valued.gemspec +4 -3
- metadata +7 -4
- data/.travis.yml +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01e8a133b1b6b38c5ad222c7d03a3ea68ca57925700a81c305dc9d66b8cd83a9
|
4
|
+
data.tar.gz: a03c152ff273d2ba821a1f96d3bc456b011b78908ccddd2f54ad0e1f8b041765
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 456eb9787c0b033387957c1cd516ccf1e17a177eb6e4b9878351a38424d96ac309e1eadfc79b4db943d0ed213edbfcb07b9089ed0a03aadc03d25a7bc467c7f0
|
7
|
+
data.tar.gz: 5cea8f73ca85b74825ef922a21a684968195a88ac5466b9d33e8be2b27391c3a454494ce5364cd60c84c2ec44ac0b4e6c0de684f16d1d8a7522f58f66043d2ce
|
@@ -0,0 +1,35 @@
|
|
1
|
+
name: Continuous Integration
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [master]
|
6
|
+
pull_request:
|
7
|
+
branches: [master]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
strategy:
|
13
|
+
matrix:
|
14
|
+
ruby-version: ["3.0"]
|
15
|
+
|
16
|
+
steps:
|
17
|
+
- uses: actions/checkout@v2
|
18
|
+
- name: Setup Node.js 🖲
|
19
|
+
uses: actions/setup-node@v2.4.0
|
20
|
+
with:
|
21
|
+
node-version: 16.x
|
22
|
+
check-latest: true
|
23
|
+
- run: npm ci
|
24
|
+
|
25
|
+
- name: Check formatting 🔍
|
26
|
+
run: npm run lint
|
27
|
+
|
28
|
+
- name: Setup Ruby 💎
|
29
|
+
uses: ruby/setup-ruby@v1
|
30
|
+
with:
|
31
|
+
ruby-version: ${{ matrix.ruby-version }}
|
32
|
+
bundler-cache: true
|
33
|
+
|
34
|
+
- name: Run tests ⚙️
|
35
|
+
run: bundle exec rake
|
data/.gitignore
CHANGED
data/.tool-versions
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.4.1
|
4
|
+
|
5
|
+
- fix bug that prevented setting an attribute to `nil` with `update`
|
6
|
+
|
7
|
+
## 0.4.0
|
8
|
+
|
9
|
+
- remove possibility to use attributes with question marks
|
10
|
+
|
3
11
|
## 0.3.0
|
4
12
|
|
5
|
-
- added a `update` method to all `Valued` and `Valued::Mutable` objects that
|
6
|
-
allows creating a duplicate of an object with changed attributes
|
13
|
+
- added a `update` method to all `Valued` and `Valued::Mutable` objects that allows creating a duplicate of an object with changed attributes
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
valued (0.4.
|
4
|
+
valued (0.4.1)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -14,7 +14,7 @@ GEM
|
|
14
14
|
ast (~> 2.4.0)
|
15
15
|
rainbow (3.0.0)
|
16
16
|
rake (13.0.1)
|
17
|
-
rexml (3.2.
|
17
|
+
rexml (3.2.5)
|
18
18
|
rspec (3.9.0)
|
19
19
|
rspec-core (~> 3.9.0)
|
20
20
|
rspec-expectations (~> 3.9.0)
|
@@ -53,4 +53,4 @@ DEPENDENCIES
|
|
53
53
|
valued!
|
54
54
|
|
55
55
|
BUNDLED WITH
|
56
|
-
2.
|
56
|
+
2.2.22
|
data/lib/valued.rb
CHANGED
@@ -3,12 +3,8 @@ require 'valued/version'
|
|
3
3
|
|
4
4
|
module Valued
|
5
5
|
module ClassMethods
|
6
|
-
def self.define_method(attr, klass)
|
7
|
-
klass.class_eval { attr_reader attr }
|
8
|
-
end
|
9
|
-
|
10
6
|
def attributes(*attributes)
|
11
|
-
attributes.each { |
|
7
|
+
attributes.each { |attribute| self.class_eval { attr_reader attribute } }
|
12
8
|
define_method('_attributes') { attributes }
|
13
9
|
private :_attributes
|
14
10
|
end
|
@@ -43,7 +39,11 @@ module Valued
|
|
43
39
|
def update(new_attributes)
|
44
40
|
self.class.new(
|
45
41
|
_attributes.each_with_object({}) do |attribute, result|
|
46
|
-
|
42
|
+
if new_attributes.key?(attribute)
|
43
|
+
result[attribute] = new_attributes[attribute]
|
44
|
+
else
|
45
|
+
result[attribute] = self.send(attribute)
|
46
|
+
end
|
47
47
|
end
|
48
48
|
)
|
49
49
|
end
|
@@ -74,9 +74,9 @@ module Valued
|
|
74
74
|
|
75
75
|
def inspect
|
76
76
|
inspected_attributes =
|
77
|
-
_attributes
|
78
|
-
"#{attribute}=#{send(attribute).inspect}"
|
79
|
-
|
77
|
+
_attributes
|
78
|
+
.map { |attribute| "#{attribute}=#{send(attribute).inspect}" }
|
79
|
+
.join(' ')
|
80
80
|
"#<#{self.class} #{inspected_attributes}>"
|
81
81
|
end
|
82
82
|
end
|
data/lib/valued/mutable.rb
CHANGED
@@ -1,13 +1,9 @@
|
|
1
1
|
module Valued
|
2
2
|
module Mutable
|
3
3
|
module ClassMethods
|
4
|
-
def self.define_method(attr, klass)
|
5
|
-
klass.class_eval { attr_accessor attr }
|
6
|
-
end
|
7
|
-
|
8
4
|
def attributes(*attributes)
|
9
|
-
attributes.each do |
|
10
|
-
|
5
|
+
attributes.each do |attribute|
|
6
|
+
self.class_eval { attr_accessor attribute }
|
11
7
|
end
|
12
8
|
define_method('_attributes') { attributes }
|
13
9
|
private :_attributes
|
@@ -40,7 +36,11 @@ module Valued
|
|
40
36
|
def update(new_attributes)
|
41
37
|
self.class.new(
|
42
38
|
_attributes.each_with_object({}) do |attribute, result|
|
43
|
-
|
39
|
+
if new_attributes.key?(attribute)
|
40
|
+
result[attribute] = new_attributes[attribute]
|
41
|
+
else
|
42
|
+
result[attribute] = self.send(attribute)
|
43
|
+
end
|
44
44
|
end
|
45
45
|
)
|
46
46
|
end
|
@@ -71,9 +71,9 @@ module Valued
|
|
71
71
|
|
72
72
|
def inspect
|
73
73
|
inspected_attributes =
|
74
|
-
_attributes
|
75
|
-
"#{attribute}=#{send(attribute).inspect}"
|
76
|
-
|
74
|
+
_attributes
|
75
|
+
.map { |attribute| "#{attribute}=#{send(attribute).inspect}" }
|
76
|
+
.join(' ')
|
77
77
|
"#<#{self.class} #{inspected_attributes}>"
|
78
78
|
end
|
79
79
|
end
|
data/lib/valued/version.rb
CHANGED
data/package-lock.json
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
{
|
2
|
+
"name": "valued",
|
3
|
+
"lockfileVersion": 2,
|
4
|
+
"requires": true,
|
5
|
+
"packages": {
|
6
|
+
"": {
|
7
|
+
"devDependencies": {
|
8
|
+
"@prettier/plugin-ruby": "^1.6.1",
|
9
|
+
"prettier": "^2.3.2"
|
10
|
+
}
|
11
|
+
},
|
12
|
+
"node_modules/@prettier/plugin-ruby": {
|
13
|
+
"version": "1.6.1",
|
14
|
+
"resolved": "https://registry.npmjs.org/@prettier/plugin-ruby/-/plugin-ruby-1.6.1.tgz",
|
15
|
+
"integrity": "sha512-PGDCATgVTQz0s/NB9nStiXVCIr+hG/XnKeAO/kguaHrNf8VwCpP5Ul+/KQao0z0QFBy2PDY8kWptfDQCa7WMXg==",
|
16
|
+
"dev": true,
|
17
|
+
"dependencies": {
|
18
|
+
"prettier": ">=1.10"
|
19
|
+
}
|
20
|
+
},
|
21
|
+
"node_modules/prettier": {
|
22
|
+
"version": "2.3.2",
|
23
|
+
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.3.2.tgz",
|
24
|
+
"integrity": "sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==",
|
25
|
+
"dev": true,
|
26
|
+
"bin": {
|
27
|
+
"prettier": "bin-prettier.js"
|
28
|
+
},
|
29
|
+
"engines": {
|
30
|
+
"node": ">=10.13.0"
|
31
|
+
}
|
32
|
+
}
|
33
|
+
},
|
34
|
+
"dependencies": {
|
35
|
+
"@prettier/plugin-ruby": {
|
36
|
+
"version": "1.6.1",
|
37
|
+
"resolved": "https://registry.npmjs.org/@prettier/plugin-ruby/-/plugin-ruby-1.6.1.tgz",
|
38
|
+
"integrity": "sha512-PGDCATgVTQz0s/NB9nStiXVCIr+hG/XnKeAO/kguaHrNf8VwCpP5Ul+/KQao0z0QFBy2PDY8kWptfDQCa7WMXg==",
|
39
|
+
"dev": true,
|
40
|
+
"requires": {
|
41
|
+
"prettier": ">=1.10"
|
42
|
+
}
|
43
|
+
},
|
44
|
+
"prettier": {
|
45
|
+
"version": "2.3.2",
|
46
|
+
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.3.2.tgz",
|
47
|
+
"integrity": "sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==",
|
48
|
+
"dev": true
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}
|
data/package.json
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
{
|
2
|
+
"name": "valued",
|
3
|
+
"scripts": {
|
4
|
+
"prettify": "prettier \"**/*.{ru,rb,yml,yaml,md}\" --ignore-path=\".gitignore\"",
|
5
|
+
"lint": "npm run prettify -- --check",
|
6
|
+
"format": "npm run prettify -- --write"
|
7
|
+
},
|
8
|
+
"devDependencies": {
|
9
|
+
"@prettier/plugin-ruby": "^1.6.1",
|
10
|
+
"prettier": "^2.3.2"
|
11
|
+
}
|
12
|
+
}
|
data/valued.gemspec
CHANGED
@@ -17,10 +17,11 @@ Gem::Specification.new do |spec|
|
|
17
17
|
|
18
18
|
spec.files =
|
19
19
|
Dir.chdir(File.expand_path('..', __FILE__)) do
|
20
|
-
|
21
|
-
|
22
|
-
end
|
20
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
21
|
+
f.match(%r{^(test|spec|features)/})
|
23
22
|
end
|
23
|
+
end
|
24
|
+
|
24
25
|
spec.bindir = 'exe'
|
25
26
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
26
27
|
spec.require_paths = %w[lib]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: valued
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mario Mainz
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -87,10 +87,11 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
+
- ".github/workflows/ci.yml"
|
90
91
|
- ".gitignore"
|
91
92
|
- ".rspec"
|
92
93
|
- ".rubocop.yml"
|
93
|
-
- ".
|
94
|
+
- ".tool-versions"
|
94
95
|
- CHANGELOG.md
|
95
96
|
- Gemfile
|
96
97
|
- Gemfile.lock
|
@@ -100,6 +101,8 @@ files:
|
|
100
101
|
- lib/valued.rb
|
101
102
|
- lib/valued/mutable.rb
|
102
103
|
- lib/valued/version.rb
|
104
|
+
- package-lock.json
|
105
|
+
- package.json
|
103
106
|
- valued.gemspec
|
104
107
|
homepage: https://github.com/mmainz/valued
|
105
108
|
licenses:
|
@@ -122,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
125
|
- !ruby/object:Gem::Version
|
123
126
|
version: '0'
|
124
127
|
requirements: []
|
125
|
-
rubygems_version: 3.
|
128
|
+
rubygems_version: 3.2.22
|
126
129
|
signing_key:
|
127
130
|
specification_version: 4
|
128
131
|
summary: A Ruby gem that makes it easy to create value objects.
|