attributor-flatpack 1.2.0 → 1.2.1

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: affc8c3c2873f34c39dd083c7f0389aa98d6c36f
4
- data.tar.gz: 8271d20c249cd84bb790fdb8292834dc1695bcf3
3
+ metadata.gz: a37ffa718fb1d4c654994475aae6d29c1c58f303
4
+ data.tar.gz: 1c3383756317c34d64fb58569f84290aa55d955e
5
5
  SHA512:
6
- metadata.gz: 4520f36e86e7125c3bcea1ffb1d79c94bb2332798c6695df879da4860b95c6ca8aec5b02adff40780fb2b70780037ba21af8bfa8e3c4fe35ab362756edb0f961
7
- data.tar.gz: e067619b0cdee778e8306bdea753454d2c818ac2f66d1a415bf49689f755b12069cb9f4f4958037f1f53188e54ffbff7927e45d04f72f67d9e12f30fc1c2ef17
6
+ metadata.gz: df68bfef26a9fcd05bd5abc29246a4a5358cbd215ff7a9757545daed4683b5b08bf45eb44f3c95149cc76d04ad7422c94681506201f83dc449808d2e82f4cc3c
7
+ data.tar.gz: 1451ec4ad454938ff1acefbe0e6cc3cdb5aad964a48c762fadf9a7f90fefc72fea5d01a24d8062a4d2ef6ab67a013f3d843579a3d2fba96b635e96bcfd51b9bd
@@ -1,7 +1,7 @@
1
1
  module Attributor
2
2
  module Flatpack
3
3
  class Config < Attributor::Hash
4
- DEFAULT_SEPARATOR = '_'.freeze
4
+ @separator = '_'.freeze
5
5
  @key_type = Symbol
6
6
 
7
7
  class << self
@@ -14,8 +14,9 @@ module Attributor
14
14
 
15
15
  def self.inherited(klass)
16
16
  super
17
+ sep = self.separator
17
18
  klass.instance_eval do
18
- @separator = Attributor::Flatpack::Config::DEFAULT_SEPARATOR
19
+ @separator = sep
19
20
  end
20
21
  klass.options[:dsl_compiler] = ConfigDSLCompiler
21
22
  end
@@ -42,7 +43,6 @@ module Attributor
42
43
  def define_reader(name)
43
44
  attribute = self.class.keys[name]
44
45
  context = default_context(name)
45
-
46
46
  define_singleton_method(name) do
47
47
  get(name, attribute: attribute, context: context)
48
48
  end
@@ -7,7 +7,13 @@ module Attributor
7
7
  raise ArgumentError, "Invalid key: #{name.inspect}, " \
8
8
  "must be instance of #{native_key}"
9
9
  end
10
- attr_type = Attributor::Flatpack::Config if attr_type.nil? && block
10
+ if attr_type.nil? && block
11
+ sep = target.separator
12
+ # Ensure class for subkeys uses the same separator as the parent
13
+ attr_type = ::Class.new(Attributor::Flatpack::Config) do
14
+ separator sep
15
+ end
16
+ end
11
17
  target.keys[name] = define(name, attr_type, **opts, &block)
12
18
  end
13
19
  end
@@ -1,5 +1,5 @@
1
1
  module Attributor
2
2
  module Flatpack
3
- VERSION = '1.2.0'.freeze
3
+ VERSION = '1.2.1'.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.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dane Jensen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-09 00:00:00.000000000 Z
11
+ date: 2018-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: attributor