tumugi 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3466a5b94c0069c0a4b07c50537904268bd2bd48
4
- data.tar.gz: 1f1a5ecba63e147079f74df154cc13c1d907f824
3
+ metadata.gz: e0da0502fdc3a3597274e65a853e7433393f07b1
4
+ data.tar.gz: 5f135e5d6dc31bbd0f61fae38de75febe63c9f97
5
5
  SHA512:
6
- metadata.gz: 0bfc9d4ed96a7e74f6ba4afb164d77c5c116cd9488a6a0c64edb54fa230fd496e1bae2b20023abbfeff1b06f7afc4fa017508ed376b4f09e610bb177f9dd391d
7
- data.tar.gz: 842c78985f9acbc1d4a45edce1d02c4c9084b867d8630fdeff69dfd51b38e5ac651e99794733edd6b84662fb302ec9f9824a32c8a41a84b3d3dcf0a6447f0c8b
6
+ metadata.gz: f50123341f96baf3c9b39e05dd1f3cc5730e0d36cc5f2b2c22b4cfc55b57778cf6c5813a663ebfd18b4615066c32c74af8d70bb7fc6afed283ae9c229441b405
7
+ data.tar.gz: 6e2db1837fd0edca19cbe15069569f9de41b8ff4d9ecd3ee9ec18a4336928c66e2a54e80532124f4ba784ae4d8bec037095d90fcbbf9b01a31a165b472bc88b3
data/CHANGELOG.md CHANGED
@@ -1,7 +1,18 @@
1
1
  # Change Log
2
2
 
3
- ## [0.4.2](https://github.com/tumugi/tumugi/tree/0.4.2) (2016-05-10)
4
- [Full Changelog](https://github.com/tumugi/tumugi/compare/v0.4.1...0.4.2)
3
+ ## [0.4.3](https://github.com/tumugi/tumugi/tree/0.4.3) (2016-05-12)
4
+ [Full Changelog](https://github.com/tumugi/tumugi/compare/v0.4.2...0.4.3)
5
+
6
+ **Implemented enhancements:**
7
+
8
+ - Param set accept proc [\#45](https://github.com/tumugi/tumugi/pull/45) ([hakobera](https://github.com/hakobera))
9
+
10
+ **Fixed bugs:**
11
+
12
+ - Fix param\_set in subclass overrite parent class param [\#44](https://github.com/tumugi/tumugi/pull/44) ([hakobera](https://github.com/hakobera))
13
+
14
+ ## [v0.4.2](https://github.com/tumugi/tumugi/tree/v0.4.2) (2016-05-10)
15
+ [Full Changelog](https://github.com/tumugi/tumugi/compare/v0.4.1...v0.4.2)
5
16
 
6
17
  **Fixed bugs:**
7
18
 
@@ -9,6 +20,7 @@
9
20
 
10
21
  **Merged pull requests:**
11
22
 
23
+ - Prepare release for v0.4.2 [\#43](https://github.com/tumugi/tumugi/pull/43) ([hakobera](https://github.com/hakobera))
12
24
  - Fix parent class parameters are not visible in a subclass [\#42](https://github.com/tumugi/tumugi/pull/42) ([hakobera](https://github.com/hakobera))
13
25
 
14
26
  ## [v0.4.1](https://github.com/tumugi/tumugi/tree/v0.4.1) (2016-05-09)
@@ -11,10 +11,11 @@ module Tumugi
11
11
  def initialize
12
12
  super()
13
13
  proxy = self.class.merged_parameter_proxy
14
- params = proxy.params
14
+ params = proxy.params.dup
15
15
  proxy.param_defaults.each do |name, value|
16
- param = params[name]
17
- param.overwrite_default(value) if param
16
+ if params[name]
17
+ params[name] = params[name].merge_default_value(value)
18
+ end
18
19
  end
19
20
  params.each do |name, param|
20
21
  unless proxy.param_auto_bind_enabled.nil?
@@ -56,7 +57,15 @@ module Tumugi
56
57
 
57
58
  def param(name, opts={})
58
59
  parameter_proxy(proxy_id).param(name, opts)
59
- attr_accessor name
60
+ attr_writer name
61
+ define_method(name) do
62
+ val = self.instance_variable_get("@#{name}")
63
+ if val.instance_of?(Proc)
64
+ self.instance_exec(&val)
65
+ else
66
+ val
67
+ end
68
+ end
60
69
  end
61
70
 
62
71
  def param_set(name, value)
@@ -48,9 +48,8 @@ module Tumugi
48
48
  @opts[:default] || nil
49
49
  end
50
50
 
51
- def overwrite_default(value)
52
- @opts[:required] = false
53
- @opts[:default] = value
51
+ def merge_default_value(value)
52
+ self.class.new(@name, @opts.merge(required: false, default: value))
54
53
  end
55
54
 
56
55
  private
@@ -1,3 +1,3 @@
1
1
  module Tumugi
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tumugi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuyuki Honda
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-10 00:00:00.000000000 Z
11
+ date: 2016-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel