lib/dmapparser/builder.rb in dmapparser-0.0.2 vs lib/dmapparser/builder.rb in dmapparser-0.1.0
- old
+ new
@@ -14,11 +14,11 @@
def method_missing(method, *args, &block)
tag = TagDefinition[method]
return super if tag.nil?
- if block_given?
+ if block_given? || tag.container?
fail "Tag #{tag} is not a container type" unless tag.container?
build_container(tag, &block)
else
build_tag(tag, args)
end
@@ -33,10 +33,10 @@
else
fail 'Cannot build DMAP without a valid container'
end
end
- def build_container(tag , &block)
+ def build_container(tag, &block)
@dmap_stack << TagContainer.new(tag)
instance_exec(&block)
if @dmap_stack.length > 1
cur_tag = @dmap_stack.pop
@dmap_stack.last.value << cur_tag