提交 8cda1321 编写于 作者: T thedarkone

Make InheritableOptions's constructor more flexible.

上级 918dc273
...@@ -30,7 +30,7 @@ def config ...@@ -30,7 +30,7 @@ def config
superclass.config.inheritable_copy superclass.config.inheritable_copy
else else
# create a new "anonymous" class that will host the compiled reader methods # create a new "anonymous" class that will host the compiled reader methods
Class.new(Configuration).new({}) Class.new(Configuration).new
end end
end end
......
...@@ -36,8 +36,12 @@ def method_missing(name, *args) ...@@ -36,8 +36,12 @@ def method_missing(name, *args)
end end
class InheritableOptions < OrderedOptions class InheritableOptions < OrderedOptions
def initialize(parent) def initialize(parent = nil)
super() { |h,k| parent[k] } if parent
super() { |h,k| parent[k] }
else
super()
end
end end
def inheritable_copy def inheritable_copy
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册