open_dsl 0.1 → 0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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