• R/O
  • SSH
  • HTTPS

tenarai: 提交


Commit MetaInfo

修訂80 (tree)
時間2008-04-15 19:33:09
作者junkikuchi

Log Message

updated.

Change Summary

差異

--- trunk/lib/tenarai/preference.rb (revision 79)
+++ trunk/lib/tenarai/preference.rb (revision 80)
@@ -14,20 +14,30 @@
1414
1515 def initialize(name, param={}, &block)
1616 super(name)
17- @param = {:label => @name.to_s.capitalize, :value => nil}.merge(param)
18- @param.each do |key, val|
19- instance_eval <<-END
20- def #{key}
21- @param[:#{key}]
22- end
23- def #{key}=(val)
24- @param[:#{key}] = val
25- end
26- END
27- end
17+
18+ @param = param.clone
19+ @param[:label] ||= @name.capitalize
20+ @param[:value] ||= nil
21+
2822 block.call(self) if block_given?
2923 end
3024
25+ def label
26+ @param[:label]
27+ end
28+
29+ def label=(val)
30+ @param[:label] = val
31+ end
32+
33+ def value
34+ @param[:value]
35+ end
36+
37+ def value=(val)
38+ @param[:value] = val
39+ end
40+
3141 def deep_clone
3242 inject(self.class.new(@name, @param)) do |ret, val|
3343 ret << val.deep_clone
Show on old repository browser