declarative 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +4 -0
- data/lib/declarative/defaults.rb +4 -9
- data/lib/declarative/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c98390ed3e76619fa18ba957ed6b03b05929dd09
|
4
|
+
data.tar.gz: 66134914bba1a3b8fc39d9f4316e0292dcd53ff0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 203b7692773222fe5104e464ac6444fb571b0d0df9b8625be00f7c8b8d03f3dbc8e76972ed19f3128c4c946ca0a98045e6b787ca5dfd00d98310a92667707680
|
7
|
+
data.tar.gz: 364e53c6e76737d40c1255fca40c7f62db0b20902b4b05238a696579d5d2df0c18a385b000a547a2681b3ef705c155a53c29e55585033278d30a82e393f7b8c3
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
# 0.0.7
|
2
|
+
|
3
|
+
* Simplify `Defaults` and remove a warning in Ruby 2.2.3.
|
4
|
+
|
1
5
|
# 0.0.6
|
2
6
|
|
3
7
|
* `Heritage#call` now accepts a block that allows processing the arguments for every recorded statement before replaying them. This provides a hook to inject or change parameters, e.g. to mark a replay as an inheritance.
|
data/lib/declarative/defaults.rb
CHANGED
@@ -3,7 +3,8 @@ require "uber/delegates"
|
|
3
3
|
module Declarative
|
4
4
|
class Defaults
|
5
5
|
def initialize
|
6
|
-
@static_options
|
6
|
+
@static_options = {}
|
7
|
+
@dynamic_options = ->(*) { Hash.new }
|
7
8
|
end
|
8
9
|
|
9
10
|
def merge!(hash, &block)
|
@@ -18,14 +19,8 @@ module Declarative
|
|
18
19
|
# TODO: allow to receive rest of options/block in dynamic block. or, rather, test it as it was already implemented.
|
19
20
|
def call(name, given_options)
|
20
21
|
options = @static_options
|
21
|
-
options = options.merge(dynamic_options(name, given_options))
|
22
|
+
options = options.merge(@dynamic_options.(name, given_options))
|
22
23
|
options = options.merge(given_options)
|
23
24
|
end
|
24
|
-
|
25
|
-
private
|
26
|
-
def dynamic_options(name, given_options)
|
27
|
-
return {} if @dynamic_options.nil?
|
28
|
-
@dynamic_options.call(name, given_options)
|
29
|
-
end
|
30
25
|
end
|
31
|
-
end
|
26
|
+
end
|
data/lib/declarative/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: declarative
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: uber
|