lib/damn/legacy/dsl.rb in damn-legacy-0.0.1 vs lib/damn/legacy/dsl.rb in damn-legacy-0.0.2
- old
+ new
@@ -13,10 +13,15 @@
def step(&block)
raise ArgumentError, "No block provided" unless block_given?
val = block.call
- if !val.nil? && !Store.instance.stack.empty? && self == Store.instance.stack.first[1]
+ if val.nil?
+ head, = Store.instance.stack.shift
+ return head.to_s
+ end
+
+ if !Store.instance.stack.empty? && self == Store.instance.stack.first[1]
each do |key|
Store.instance.add(key, val)
end
else
head, = Store.instance.stack.shift