diva 1.1.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/.circleci/config.yml +8 -8
- data/.rubocop.yml +53 -2
- data/Rakefile +5 -5
- data/bin/console +3 -3
- data/diva.gemspec +23 -19
- data/lib/diva/model.rb +11 -3
- data/lib/diva/version.rb +1 -1
- metadata +26 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52c5dec5bafdde2ee52163337ccb79c65cf1ffa0090da2401585dbf567e92abc
|
4
|
+
data.tar.gz: b022d6956eb21bcca85203eb989b7d1c8b4dd4b3854f17348b2c150af3b2a3c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d7b1858e1b3722d22fe28f45c612dbdaa2a9c30f19658c6d876acf41d6b6e93cd252f6ca69563ef5826148e83881ff8bad34057d71eb4dee1f6b6123543dd2d
|
7
|
+
data.tar.gz: f11d4bd094c84857fb5f5dc78644cc9940489e47d506b09930dec55d222b7cc2f58f608265d7acaedfb98bcf78e90a959b1d6ea3356eb255d78c297d5a6a70f4
|
data/.circleci/config.yml
CHANGED
@@ -6,7 +6,7 @@ executors:
|
|
6
6
|
tag:
|
7
7
|
type: string
|
8
8
|
docker:
|
9
|
-
- image:
|
9
|
+
- image: ruby:<< parameters.tag >>
|
10
10
|
|
11
11
|
jobs:
|
12
12
|
build:
|
@@ -49,19 +49,19 @@ workflows:
|
|
49
49
|
jobs:
|
50
50
|
- lint:
|
51
51
|
name: 'lint'
|
52
|
-
ruby-version: '3.0.
|
52
|
+
ruby-version: '3.0.3'
|
53
53
|
- build:
|
54
|
-
name: 'ruby-2.
|
55
|
-
ruby-version: '2.
|
54
|
+
name: 'ruby-2.7'
|
55
|
+
ruby-version: '2.7.5'
|
56
56
|
requires:
|
57
57
|
- 'lint'
|
58
58
|
- build:
|
59
|
-
name: 'ruby-
|
60
|
-
ruby-version: '
|
59
|
+
name: 'ruby-3.0'
|
60
|
+
ruby-version: '3.0.3'
|
61
61
|
requires:
|
62
62
|
- 'lint'
|
63
63
|
- build:
|
64
|
-
name: 'ruby-3.
|
65
|
-
ruby-version: '3.0
|
64
|
+
name: 'ruby-3.1'
|
65
|
+
ruby-version: '3.1.0-preview1'
|
66
66
|
requires:
|
67
67
|
- 'lint'
|
data/.rubocop.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
AllCops:
|
2
|
-
TargetRubyVersion: 2.
|
2
|
+
TargetRubyVersion: '2.7'
|
3
3
|
|
4
4
|
Metrics/BlockLength:
|
5
5
|
Exclude:
|
@@ -340,4 +340,55 @@ Style/RedundantArgument: # (new in 1.4)
|
|
340
340
|
Enabled: true
|
341
341
|
Style/SwapValues: # (new in 1.1)
|
342
342
|
Enabled: true
|
343
|
-
|
343
|
+
Gemspec/DateAssignment: # new in 1.10
|
344
|
+
Enabled: true
|
345
|
+
Gemspec/RequireMFA: # new in 1.23
|
346
|
+
Enabled: true
|
347
|
+
Layout/LineEndStringConcatenationIndentation: # new in 1.18
|
348
|
+
Enabled: true
|
349
|
+
Lint/AmbiguousOperatorPrecedence: # new in 1.21
|
350
|
+
Enabled: false
|
351
|
+
Lint/AmbiguousRange: # new in 1.19
|
352
|
+
Enabled: true
|
353
|
+
RequireParenthesesForMethodChains: true
|
354
|
+
Lint/EmptyInPattern: # new in 1.16
|
355
|
+
Enabled: true
|
356
|
+
Lint/IncompatibleIoSelectWithFiberScheduler: # new in 1.21
|
357
|
+
Enabled: true
|
358
|
+
Lint/NumberedParameterAssignment: # new in 1.9
|
359
|
+
Enabled: true
|
360
|
+
Lint/OrAssignmentToConstant: # new in 1.9
|
361
|
+
Enabled: true
|
362
|
+
Lint/RequireRelativeSelfPath: # new in 1.22
|
363
|
+
Enabled: true
|
364
|
+
Lint/SymbolConversion: # new in 1.9
|
365
|
+
Enabled: true
|
366
|
+
Lint/TripleQuotes: # new in 1.9
|
367
|
+
Enabled: true
|
368
|
+
Lint/UselessRuby2Keywords: # new in 1.23
|
369
|
+
Enabled: true
|
370
|
+
Security/IoMethods: # new in 1.22
|
371
|
+
Enabled: true
|
372
|
+
Style/HashConversion: # new in 1.10
|
373
|
+
Enabled: true
|
374
|
+
Style/IfWithBooleanLiteralBranches: # new in 1.9
|
375
|
+
Enabled: true
|
376
|
+
Style/InPatternThen: # new in 1.16
|
377
|
+
Enabled: true
|
378
|
+
Style/MultilineInPatternThen: # new in 1.16
|
379
|
+
Enabled: true
|
380
|
+
Style/NumberedParameters: # new in 1.22
|
381
|
+
Enabled: true
|
382
|
+
Style/NumberedParametersLimit: # new in 1.22
|
383
|
+
Enabled: true
|
384
|
+
Max: 1
|
385
|
+
Style/OpenStructUse: # new in 1.23
|
386
|
+
Enabled: true
|
387
|
+
Style/QuotedSymbols: # new in 1.16
|
388
|
+
Enabled: true
|
389
|
+
Style/RedundantSelfAssignmentBranch: # new in 1.19
|
390
|
+
Enabled: true
|
391
|
+
Style/SelectByRegexp: # new in 1.22
|
392
|
+
Enabled: true
|
393
|
+
Style/StringChars: # new in 1.12
|
394
|
+
Enabled: true
|
data/Rakefile
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rake/testtask'
|
3
3
|
|
4
4
|
Rake::TestTask.new(:test) do |t|
|
5
|
-
t.libs <<
|
6
|
-
t.libs <<
|
5
|
+
t.libs << 'test'
|
6
|
+
t.libs << 'lib'
|
7
7
|
t.test_files = FileList['test/**/*_test.rb']
|
8
8
|
end
|
9
9
|
|
10
|
-
task :
|
10
|
+
task default: :test
|
data/bin/console
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'diva'
|
5
5
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -10,5 +10,5 @@ require "diva"
|
|
10
10
|
# require "pry"
|
11
11
|
# Pry.start
|
12
12
|
|
13
|
-
require
|
13
|
+
require 'irb'
|
14
14
|
IRB.start
|
data/diva.gemspec
CHANGED
@@ -1,29 +1,33 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require 'diva/version'
|
5
6
|
|
6
7
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
8
|
+
spec.name = 'diva'
|
8
9
|
spec.version = Diva::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
10
|
+
spec.authors = ['Toshiaki Asai']
|
11
|
+
spec.email = ['toshi.alternative@gmail.com']
|
11
12
|
|
12
|
-
spec.summary =
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
15
|
-
spec.required_ruby_version = '>= 2.
|
13
|
+
spec.summary = 'Implementation of expression for handling things.'
|
14
|
+
spec.homepage = 'https://github.com/toshia/diva'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
spec.required_ruby_version = '>= 2.7.0'
|
16
17
|
|
17
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r
|
18
|
-
spec.bindir =
|
19
|
-
spec.executables = spec.files.grep(%r
|
20
|
-
spec.require_paths = [
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r<^(test|spec|features)/>) }
|
19
|
+
spec.bindir = 'exe'
|
20
|
+
spec.executables = spec.files.grep(%r<^exe/>) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ['lib']
|
21
22
|
|
22
|
-
spec.add_development_dependency
|
23
|
-
spec.add_development_dependency
|
24
|
-
spec.add_development_dependency
|
25
|
-
spec.add_development_dependency
|
26
|
-
spec.add_development_dependency
|
27
|
-
spec.add_development_dependency
|
28
|
-
spec.add_dependency
|
23
|
+
spec.add_development_dependency 'bundler', '>= 1.16.1', '< 3.0'
|
24
|
+
spec.add_development_dependency 'irb', '>= 1.3.7', '< 2.0'
|
25
|
+
spec.add_development_dependency 'minitest', '>= 5.14.4', '< 5.15'
|
26
|
+
spec.add_development_dependency 'rake', '>= 13.0.1', '< 14.0'
|
27
|
+
spec.add_development_dependency 'rubocop', '>= 1.23.0', '< 1.24.0'
|
28
|
+
spec.add_development_dependency 'simplecov', '>= 0.17.1', '< 1.0'
|
29
|
+
spec.add_dependency 'addressable', '>= 2.5.2', '< 3.0'
|
30
|
+
spec.metadata = {
|
31
|
+
'rubygems_mfa_required' => 'true'
|
32
|
+
}
|
29
33
|
end
|
data/lib/diva/model.rb
CHANGED
@@ -24,7 +24,7 @@ class Diva::Model
|
|
24
24
|
# selfにあってotherにもあるカラムはotherの内容で上書きされる。
|
25
25
|
# 上書き後、データはDataSourceに保存される
|
26
26
|
def merge(other)
|
27
|
-
@value.update(other.
|
27
|
+
@value.update(other.to_h)
|
28
28
|
validate
|
29
29
|
self.class.store_datum(self)
|
30
30
|
end
|
@@ -80,7 +80,7 @@ class Diva::Model
|
|
80
80
|
self == other
|
81
81
|
end
|
82
82
|
|
83
|
-
def
|
83
|
+
def to_h
|
84
84
|
self.class.fields.to_h { |f| [f.name, fetch(f.name)] }
|
85
85
|
end
|
86
86
|
|
@@ -114,7 +114,7 @@ class Diva::Model
|
|
114
114
|
# キーとして定義されていない値を全て除外した配列を生成して返す。
|
115
115
|
# また、Modelを子に含んでいる場合、それを外部キーに変換する。
|
116
116
|
def filtering
|
117
|
-
datum =
|
117
|
+
datum = to_h
|
118
118
|
result = {}
|
119
119
|
self.class.fields.each do |field|
|
120
120
|
result[field.name] = field.type.cast(datum[field.name])
|
@@ -146,6 +146,14 @@ class Diva::Model
|
|
146
146
|
end
|
147
147
|
end
|
148
148
|
|
149
|
+
def deconstruct_keys(keys)
|
150
|
+
if keys
|
151
|
+
@value.slice(*keys) # 高速化のため、fetchを呼び出していない
|
152
|
+
else
|
153
|
+
@value
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
149
157
|
private
|
150
158
|
|
151
159
|
# URIがデフォルトで使うpath要素
|
data/lib/diva/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: diva
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toshiaki Asai
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -31,25 +31,25 @@ dependencies:
|
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '3.0'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
34
|
+
name: irb
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
39
|
+
version: 1.3.7
|
40
40
|
- - "<"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '
|
42
|
+
version: '2.0'
|
43
43
|
type: :development
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version:
|
49
|
+
version: 1.3.7
|
50
50
|
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: '
|
52
|
+
version: '2.0'
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: minitest
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -71,65 +71,65 @@ dependencies:
|
|
71
71
|
- !ruby/object:Gem::Version
|
72
72
|
version: '5.15'
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
|
-
name:
|
74
|
+
name: rake
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
76
76
|
requirements:
|
77
77
|
- - ">="
|
78
78
|
- !ruby/object:Gem::Version
|
79
|
-
version:
|
79
|
+
version: 13.0.1
|
80
80
|
- - "<"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '14.0'
|
83
83
|
type: :development
|
84
84
|
prerelease: false
|
85
85
|
version_requirements: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 13.0.1
|
90
90
|
- - "<"
|
91
91
|
- !ruby/object:Gem::Version
|
92
|
-
version: '
|
92
|
+
version: '14.0'
|
93
93
|
- !ruby/object:Gem::Dependency
|
94
|
-
name:
|
94
|
+
name: rubocop
|
95
95
|
requirement: !ruby/object:Gem::Requirement
|
96
96
|
requirements:
|
97
97
|
- - ">="
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version:
|
99
|
+
version: 1.23.0
|
100
100
|
- - "<"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
102
|
+
version: 1.24.0
|
103
103
|
type: :development
|
104
104
|
prerelease: false
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
107
|
- - ">="
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
109
|
+
version: 1.23.0
|
110
110
|
- - "<"
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version:
|
112
|
+
version: 1.24.0
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
|
-
name:
|
114
|
+
name: simplecov
|
115
115
|
requirement: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
117
|
- - ">="
|
118
118
|
- !ruby/object:Gem::Version
|
119
|
-
version:
|
119
|
+
version: 0.17.1
|
120
120
|
- - "<"
|
121
121
|
- !ruby/object:Gem::Version
|
122
|
-
version: 1.
|
122
|
+
version: '1.0'
|
123
123
|
type: :development
|
124
124
|
prerelease: false
|
125
125
|
version_requirements: !ruby/object:Gem::Requirement
|
126
126
|
requirements:
|
127
127
|
- - ">="
|
128
128
|
- !ruby/object:Gem::Version
|
129
|
-
version:
|
129
|
+
version: 0.17.1
|
130
130
|
- - "<"
|
131
131
|
- !ruby/object:Gem::Version
|
132
|
-
version: 1.
|
132
|
+
version: '1.0'
|
133
133
|
- !ruby/object:Gem::Dependency
|
134
134
|
name: addressable
|
135
135
|
requirement: !ruby/object:Gem::Requirement
|
@@ -182,7 +182,8 @@ files:
|
|
182
182
|
homepage: https://github.com/toshia/diva
|
183
183
|
licenses:
|
184
184
|
- MIT
|
185
|
-
metadata:
|
185
|
+
metadata:
|
186
|
+
rubygems_mfa_required: 'true'
|
186
187
|
post_install_message:
|
187
188
|
rdoc_options: []
|
188
189
|
require_paths:
|
@@ -191,14 +192,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
191
192
|
requirements:
|
192
193
|
- - ">="
|
193
194
|
- !ruby/object:Gem::Version
|
194
|
-
version: 2.
|
195
|
+
version: 2.7.0
|
195
196
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
196
197
|
requirements:
|
197
198
|
- - ">="
|
198
199
|
- !ruby/object:Gem::Version
|
199
200
|
version: '0'
|
200
201
|
requirements: []
|
201
|
-
rubygems_version: 3.2.
|
202
|
+
rubygems_version: 3.2.29
|
202
203
|
signing_key:
|
203
204
|
specification_version: 4
|
204
205
|
summary: Implementation of expression for handling things.
|