Sha256: a698420f8088b643f27215c1114a1ebf71c350eaca2acfce1ad993355a868f7b

Contents?: true

Size: 418 Bytes

Versions: 1

Compression:

Stored size: 418 Bytes

Contents

require 'supa/command'

module Supa
  module Commands
    class Polymorphic < Supa::Command
      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
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
supa-0.1.1 lib/supa/commands/polymorphic.rb