open_dsl 0.3 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/open_dsl/context.rb +6 -2
- data/lib/open_dsl.rb +1 -1
- metadata +3 -2
data/lib/open_dsl/context.rb
CHANGED
@@ -66,12 +66,16 @@ module OpenDsl
|
|
66
66
|
@stack.bottom << value
|
67
67
|
else
|
68
68
|
define_getter_and_setter_if_needed(name)
|
69
|
-
@
|
69
|
+
if @toplevel_object_already_exists && value.nil?
|
70
|
+
@stack.bottom.send("#{name}=", true)
|
71
|
+
else
|
72
|
+
@stack.bottom.send("#{name}=", value)
|
73
|
+
end
|
70
74
|
end
|
71
75
|
end
|
72
76
|
|
73
77
|
def define_getter_and_setter_if_needed(name)
|
74
|
-
return if
|
78
|
+
return if @stack.bottom.respond_to?("#{name}=")
|
75
79
|
raise "Expected #{@toplevel_object.class.name} to have defined a setter method for '#{name}'" if @toplevel_object_already_exists
|
76
80
|
|
77
81
|
@stack.bottom.class.instance_eval do
|
data/lib/open_dsl.rb
CHANGED
metadata
CHANGED