Permalink
Browse files

Also make the class configurable.

git-svn-id: http://svn.macosforge.org/repository/ruby/DietRB/trunk@4864 23306eb0-4c56-4727-a40e-e92c0eb68959
  • Loading branch information...
1 parent 363fe31 commit 01c4c4ecab5be3e7be0369a8b6f2bf8fd264f08c @alloy alloy committed Nov 1, 2010
Showing with 7 additions and 3 deletions.
  1. +7 −3 config_prototype.rb
View
@@ -7,6 +7,10 @@ def initialize(klass, name)
@options = {}
end
+ def new
+ @klass.new
+ end
+
def add_option(name, default, description)
name = name.to_s
@options[name] = [default, description]
@@ -19,9 +23,9 @@ def #{name}
end
def to_s
- @options.keys.sort.map do |name|
+ (["config.#{@name}.klass = #{@klass}"] + @options.keys.sort.map do |name|
"config.#{@name}.#{name} = #{@options[name][0]} # #{@options[name][1]}"
- end.join("\n")
+ end).join("\n")
end
def method_missing(name, *args)
@@ -79,7 +83,7 @@ class Formatter
puts config
-f = Formatter.new
+f = config.formatter.new
p f.use_inspect
f.use_inspect = false
p f.use_inspect

0 comments on commit 01c4c4e

Please sign in to comment.