lib/supa/commands/collection.rb in supa-0.1.4 vs lib/supa/commands/collection.rb in supa-0.2.0

- old
+ new

@@ -1,16 +1,16 @@ -require 'supa/command' - module Supa module Commands class Collection < Supa::Command + include Supa::Commands::Collectionable + def represent - tree[name] = [] + @tree[@name] = [] unless @options[:squash] - Array(get_value).each do |element| - tree[name] << {} + collection.each do |element| + @tree[@name] << {} - Supa::Builder.new(context: element, tree: tree[name][-1]).instance_exec(&block) + Supa::Builder.new(element, tree: @tree[@name][-1], representer: @representer).instance_exec(&@block) end end end end end