lib/peony/scope.rb in peony-0.3.0 vs lib/peony/scope.rb in peony-0.3.1

- old
+ new

@@ -67,12 +67,17 @@ def evaluate(value) ret = value.is_a?(Proc) ? value.call : value ret.nil? && block_given? ? yield : ret end + def children + @children ||= {} + end + def new_scope(name) clazz = self.class self.send(name) || Scope.new(name, self) do|_name, _scope| + children[_name] = _scope clazz.send :define_method, _name do _scope end end end