koine-attributes 0.3.2 → 0.4.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
- SHA1:
3
- metadata.gz: a19c72d876bbd78a0ca1d9531f67d505a8bcbc56
4
- data.tar.gz: a1c80eb113d8e647217406f2cc7344da59d810e7
2
+ SHA256:
3
+ metadata.gz: 3002096f43710ab47e605dd70f53bd6bae6ed3bc35bfc41c9b167af516fc216b
4
+ data.tar.gz: ea1fb534104b33a3393ef4ce46fd5efffed1680508f6bf325a3a7886ae94dec5
5
5
  SHA512:
6
- metadata.gz: 2961f6ebfcff58c613ee4d6162db926328221c8015f71f1c96cbc2902017c7980a9e71c5bc9c00acca4e69ea1fe4a15c6875e1ef9220a1eb234cda198fb052a0
7
- data.tar.gz: 89d6d885ad825e351c66b0908cb881a23ea524556ed3f2d72647429e2ddb844083e2eab22eb43e2fd58529486072822857f5636c84f41ade8a82d7768f988651
6
+ metadata.gz: 7b88072fee10d62d4e5123b353c9a0edb846c4094326f376a7c3f0da3320fac9a123e40e5d684a96d8b98cb3b9fd0b75acb2d39204caab8276f193fb552f6359
7
+ data.tar.gz: 5b3b1ef1c7bc23c6c6e16027758b9df3c6cf96d472ae5133e19008c023c2796d490964e24d77b1a67a4913e69dc983bccbbe07e730a972b5fc59395989eba3db
data/README.md CHANGED
@@ -118,6 +118,12 @@ class Product
118
118
  attribute :available, Koine::Attributes::Drivers::Boolean.new.with_default_value(true)
119
119
  attribute :tags, array_of(:string)
120
120
  attribute :config, hash_of(:symbol, :string)
121
+
122
+ # if you want to costumize the above
123
+ attribute :config, hash_of(:symbol, :string) do |adapter|
124
+ adapter.for_keys.with_nil_value
125
+ adapter.for_values.with_nil_value
126
+ end
121
127
  end
122
128
  end
123
129
 
@@ -7,6 +7,10 @@ module Koine
7
7
  with_default_value([])
8
8
  end
9
9
 
10
+ def for_values
11
+ @adapter
12
+ end
13
+
10
14
  private
11
15
 
12
16
  def coerce_not_nil(collectionOfValues)
@@ -8,6 +8,14 @@ module Koine
8
8
  with_default_value({})
9
9
  end
10
10
 
11
+ def for_keys
12
+ @key_adapter
13
+ end
14
+
15
+ def for_values
16
+ @value_adapter
17
+ end
18
+
11
19
  private
12
20
 
13
21
  def coerce_not_nil(hash)
@@ -1,5 +1,5 @@
1
1
  module Koine
2
2
  module Attributes
3
- VERSION = '0.3.2'.freeze
3
+ VERSION = '0.4.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: koine-attributes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcelo Jacobus
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-04-28 00:00:00.000000000 Z
11
+ date: 2018-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -163,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
163
163
  version: '0'
164
164
  requirements: []
165
165
  rubyforge_project:
166
- rubygems_version: 2.6.11
166
+ rubygems_version: 2.7.6
167
167
  signing_key:
168
168
  specification_version: 4
169
169
  summary: Stronger setters and getters