open_dsl 0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/open_dsl.rb +1 -1
- data/lib/open_dsl/context.rb +5 -2
- metadata +3 -3
data/lib/open_dsl.rb
CHANGED
data/lib/open_dsl/context.rb
CHANGED
@@ -4,9 +4,12 @@ module OpenDsl
|
|
4
4
|
attr_reader :toplevel_object
|
5
5
|
|
6
6
|
def initialize(const_name, &blk)
|
7
|
-
raise "Expected a constant name starting with an upper-case character, got '#{const_name}'" unless constant_or_constant_name?(const_name)
|
8
|
-
@toplevel_object = new_instance(const_name)
|
9
7
|
@stack = EvalStack.new(self)
|
8
|
+
if constant_or_constant_name?(const_name)
|
9
|
+
@toplevel_object = new_instance(const_name)
|
10
|
+
else
|
11
|
+
@toplevel_object = Array.new
|
12
|
+
end
|
10
13
|
@stack.eval_and_keep(@toplevel_object, &blk)
|
11
14
|
end
|
12
15
|
|
metadata
CHANGED