Class: Supa::Commands::Collection

Inherits:
Supa::Command show all
Defined in:
lib/supa/commands/collection.rb

Instance Method Summary collapse

Methods inherited from Supa::Command

#initialize

Constructor Details

This class inherits a constructor from Supa::Command

Instance Method Details

#representObject



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/supa/commands/collection.rb', line 6

def represent
  values = with_getter? ? context.instance_exec(&getter) : context.send(name)

  tree[name] = []

  Array(values).each do |value|
    tree[name] << {}

    Supa::Builder.new(context: value, tree: tree[name][-1]).instance_exec(&block)
  end
end