attributor-flatpack 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +4 -0
- data/attributor-flatpack.gemspec +7 -7
- data/benchmark/Gemfile +1 -1
- data/benchmark/bench.rb +1 -1
- data/examples/sample_config.rb +1 -1
- data/lib/attributor/flatpack/config.rb +22 -10
- data/lib/attributor/flatpack/version.rb +1 -1
- metadata +41 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: affc8c3c2873f34c39dd083c7f0389aa98d6c36f
|
4
|
+
data.tar.gz: 8271d20c249cd84bb790fdb8292834dc1695bcf3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4520f36e86e7125c3bcea1ffb1d79c94bb2332798c6695df879da4860b95c6ca8aec5b02adff40780fb2b70780037ba21af8bfa8e3c4fe35ab362756edb0f961
|
7
|
+
data.tar.gz: e067619b0cdee778e8306bdea753454d2c818ac2f66d1a415bf49689f755b12069cb9f4f4958037f1f53188e54ffbff7927e45d04f72f67d9e12f30fc1c2ef17
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.4.3
|
data/CHANGELOG.md
CHANGED
data/attributor-flatpack.gemspec
CHANGED
@@ -1,9 +1,8 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require 'attributor/flatpack/version'
|
5
4
|
|
6
|
-
Gem::Specification.new do |spec|
|
5
|
+
Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
|
7
6
|
spec.name = 'attributor-flatpack'
|
8
7
|
spec.version = Attributor::Flatpack::VERSION
|
9
8
|
spec.authors = ['Dane Jensen']
|
@@ -22,14 +21,15 @@ Gem::Specification.new do |spec|
|
|
22
21
|
|
23
22
|
spec.add_dependency 'attributor', '>= 5'
|
24
23
|
spec.add_development_dependency 'bundler', '~> 1.11'
|
25
|
-
spec.add_development_dependency '
|
26
|
-
spec.add_development_dependency 'rspec', '~> 3.0'
|
27
|
-
spec.add_development_dependency 'rspec-its'
|
24
|
+
spec.add_development_dependency 'codeclimate-test-reporter'
|
28
25
|
spec.add_development_dependency 'fuubar', '~> 2'
|
29
26
|
spec.add_development_dependency 'guard'
|
30
27
|
spec.add_development_dependency 'guard-rspec'
|
31
28
|
spec.add_development_dependency 'guard-rubocop'
|
32
29
|
spec.add_development_dependency 'pry'
|
33
30
|
spec.add_development_dependency 'pry-byebug'
|
34
|
-
spec.add_development_dependency '
|
31
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
32
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
33
|
+
spec.add_development_dependency 'rspec-its'
|
34
|
+
spec.add_development_dependency 'simplecov'
|
35
35
|
end
|
data/benchmark/Gemfile
CHANGED
data/benchmark/bench.rb
CHANGED
data/examples/sample_config.rb
CHANGED
@@ -3,7 +3,7 @@ require 'bundler/setup'
|
|
3
3
|
require 'pry'
|
4
4
|
require 'pry-byebug'
|
5
5
|
|
6
|
-
$LOAD_PATH.unshift File.expand_path('
|
6
|
+
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
|
7
7
|
require 'attributor/flatpack'
|
8
8
|
|
9
9
|
class SampleConfig < Attributor::Flatpack::Config
|
@@ -1,10 +1,22 @@
|
|
1
1
|
module Attributor
|
2
2
|
module Flatpack
|
3
3
|
class Config < Attributor::Hash
|
4
|
+
DEFAULT_SEPARATOR = '_'.freeze
|
4
5
|
@key_type = Symbol
|
5
6
|
|
7
|
+
class << self
|
8
|
+
def separator(sep = nil)
|
9
|
+
return @separator unless sep
|
10
|
+
|
11
|
+
@separator = sep
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
6
15
|
def self.inherited(klass)
|
7
16
|
super
|
17
|
+
klass.instance_eval do
|
18
|
+
@separator = Attributor::Flatpack::Config::DEFAULT_SEPARATOR
|
19
|
+
end
|
8
20
|
klass.options[:dsl_compiler] = ConfigDSLCompiler
|
9
21
|
end
|
10
22
|
|
@@ -35,10 +47,10 @@ module Attributor
|
|
35
47
|
get(name, attribute: attribute, context: context)
|
36
48
|
end
|
37
49
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
50
|
+
return unless attribute.type == Attributor::Boolean
|
51
|
+
|
52
|
+
define_singleton_method(name.to_s + '?') do
|
53
|
+
!!get(name, attribute: attribute, context: context)
|
42
54
|
end
|
43
55
|
end
|
44
56
|
|
@@ -89,7 +101,7 @@ module Attributor
|
|
89
101
|
return @raw[key] if @raw.key?(key)
|
90
102
|
|
91
103
|
_found_key, found_value = @raw.find do |(k, _v)|
|
92
|
-
k.to_s.casecmp(key.to_s)
|
104
|
+
k.to_s.casecmp(key.to_s).zero?
|
93
105
|
end
|
94
106
|
|
95
107
|
return found_value if found_value
|
@@ -98,7 +110,7 @@ module Attributor
|
|
98
110
|
end
|
99
111
|
|
100
112
|
def subselect(prefix)
|
101
|
-
prefix_match = /^#{prefix.to_s}
|
113
|
+
prefix_match = /^#{prefix.to_s}#{self.class.separator}?(.*)/i
|
102
114
|
|
103
115
|
selected = @raw.collect do |(k, v)|
|
104
116
|
if (match = prefix_match.match(k))
|
@@ -108,12 +120,12 @@ module Attributor
|
|
108
120
|
::Hash[selected]
|
109
121
|
end
|
110
122
|
|
111
|
-
def [](
|
112
|
-
get
|
123
|
+
def [](key)
|
124
|
+
get key
|
113
125
|
end
|
114
126
|
|
115
|
-
def []=(
|
116
|
-
set
|
127
|
+
def []=(key, val)
|
128
|
+
set key, val
|
117
129
|
end
|
118
130
|
|
119
131
|
def merge!(other)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attributor-flatpack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dane Jensen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: attributor
|
@@ -39,35 +39,35 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.11'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: codeclimate-test-reporter
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0'
|
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: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: fuubar
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '2'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '2'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: guard
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
@@ -81,21 +81,21 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: guard-rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '0'
|
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: '
|
96
|
+
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name: guard
|
98
|
+
name: guard-rubocop
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: pry
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - ">="
|
@@ -123,7 +123,7 @@ dependencies:
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: pry-byebug
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - ">="
|
@@ -137,21 +137,35 @@ dependencies:
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
140
|
+
name: rake
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- - "
|
143
|
+
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: '0'
|
145
|
+
version: '10.0'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- - "
|
150
|
+
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: '0'
|
152
|
+
version: '10.0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
154
|
+
name: rspec
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '3.0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '3.0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: rspec-its
|
155
169
|
requirement: !ruby/object:Gem::Requirement
|
156
170
|
requirements:
|
157
171
|
- - ">="
|
@@ -165,7 +179,7 @@ dependencies:
|
|
165
179
|
- !ruby/object:Gem::Version
|
166
180
|
version: '0'
|
167
181
|
- !ruby/object:Gem::Dependency
|
168
|
-
name:
|
182
|
+
name: simplecov
|
169
183
|
requirement: !ruby/object:Gem::Requirement
|
170
184
|
requirements:
|
171
185
|
- - ">="
|
@@ -229,9 +243,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
229
243
|
version: '0'
|
230
244
|
requirements: []
|
231
245
|
rubyforge_project:
|
232
|
-
rubygems_version: 2.
|
246
|
+
rubygems_version: 2.6.14
|
233
247
|
signing_key:
|
234
248
|
specification_version: 4
|
235
249
|
summary: Attributor type for loading configuration data
|
236
250
|
test_files: []
|
237
|
-
has_rdoc:
|