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 CHANGED
@@ -8,7 +8,7 @@ require 'open_dsl/context'
8
8
  require 'open_dsl/eval_stack'
9
9
 
10
10
  module OpenDsl
11
- VERSION = '0.1'
11
+ VERSION = '0.2'
12
12
  end
13
13
 
14
14
  def open_dsl(&blk)
@@ -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
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: open_dsl
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
9
- version: "0.1"
8
+ - 2
9
+ version: "0.2"
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ian Leitch