nakajima-fixjour 0.0.3 → 0.0.4
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.
- data/lib/fixjour/builders.rb +9 -0
- metadata +1 -1
data/lib/fixjour/builders.rb
CHANGED
@@ -55,6 +55,7 @@ module Fixjour
|
|
55
55
|
def define_new(name, &block)
|
56
56
|
define_method("new_#{name}") do |*args|
|
57
57
|
overrides = args.first || { }
|
58
|
+
overrides.extend(OverrideProcessing)
|
58
59
|
result = block.bind(self).call(overrides)
|
59
60
|
result
|
60
61
|
end
|
@@ -93,5 +94,13 @@ module Fixjour
|
|
93
94
|
klass.new
|
94
95
|
end
|
95
96
|
end
|
97
|
+
|
98
|
+
module OverrideProcessing
|
99
|
+
def process(key)
|
100
|
+
if value = delete(key)
|
101
|
+
yield value
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
96
105
|
end
|
97
106
|
end
|