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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f5e442b5e561133fe9d83121a0de9452cad5e72a
4
- data.tar.gz: fc258569802189aa6c891ed13a5077e4d11a5e34
3
+ metadata.gz: affc8c3c2873f34c39dd083c7f0389aa98d6c36f
4
+ data.tar.gz: 8271d20c249cd84bb790fdb8292834dc1695bcf3
5
5
  SHA512:
6
- metadata.gz: 264a8c5d4846613446b0b72c6de974a2ff80dd986c033608fea95ace756155e885ce62c4203d25208f0c0c56445b721e6d612beef2609ad09efb654a35d88b06
7
- data.tar.gz: e6907e886c0d43c79e9b6fd9230d66be5f9e9d5aead09c0e8a3f83cc1d07cb65a3979c10db107d010a683ec13e5463e8b58a33f1dde203c8e9778baaab95a4c4
6
+ metadata.gz: 4520f36e86e7125c3bcea1ffb1d79c94bb2332798c6695df879da4860b95c6ca8aec5b02adff40780fb2b70780037ba21af8bfa8e3c4fe35ab362756edb0f961
7
+ data.tar.gz: e067619b0cdee778e8306bdea753454d2c818ac2f66d1a415bf49689f755b12069cb9f4f4958037f1f53188e54ffbff7927e45d04f72f67d9e12f30fc1c2ef17
@@ -1 +1 @@
1
- 2.2.3
1
+ 2.4.3
@@ -1,5 +1,9 @@
1
1
  # attributor-flatpack changelog
2
2
 
3
+ ## 1.2
4
+
5
+ * Add support for redefining the separator
6
+
3
7
  ## 1.1
4
8
 
5
9
  * Significant performance improvements. See [benchmark results](benchmark/output.txt) for comparisons.
@@ -1,9 +1,8 @@
1
- # coding: utf-8
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 'rake', '~> 10.0'
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 'codeclimate-test-reporter'
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
@@ -1,3 +1,3 @@
1
1
  source 'https://rubygems.org'
2
- gem 'benchmark-ips'
3
2
  gem 'attributor-flatpack', path: '../'
3
+ gem 'benchmark-ips'
@@ -43,7 +43,7 @@ poro = Poro.new(HOME, PATH)
43
43
 
44
44
  puts RUBY_DESCRIPTION
45
45
 
46
- Benchmark.ips do |x|
46
+ Benchmark.ips do |x| # rubocop:disable Metrics/BlockLength
47
47
  x.report 'constants' do |i|
48
48
  i.times do
49
49
  HOME == PATH
@@ -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('../../lib', __FILE__)
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
- if attribute.type == Attributor::Boolean
39
- define_singleton_method(name.to_s + '?') do
40
- !!get(name, attribute: attribute, context: context)
41
- end
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) == 0
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}_?(.*)/i
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 [](k)
112
- get k
123
+ def [](key)
124
+ get key
113
125
  end
114
126
 
115
- def []=(k, v)
116
- set k, v
127
+ def []=(key, val)
128
+ set key, val
117
129
  end
118
130
 
119
131
  def merge!(other)
@@ -1,5 +1,5 @@
1
1
  module Attributor
2
2
  module Flatpack
3
- VERSION = '1.1.0'.freeze
3
+ VERSION = '1.2.0'.freeze
4
4
  end
5
5
  end
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.1.0
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: 2016-03-11 00:00:00.000000000 Z
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: rake
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: '10.0'
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: '10.0'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rspec
56
+ name: fuubar
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '3.0'
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: '3.0'
68
+ version: '2'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rspec-its
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: fuubar
84
+ name: guard-rspec
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '2'
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: '2'
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: guard-rspec
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: guard-rubocop
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: pry
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: pry-byebug
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: codeclimate-test-reporter
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.4.5.1
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: