Sha256: b39d934426f42f50ada3921a90f0e84b852e8aa6372cc0fd53d840f6d92d09b1

Contents?: true

Size: 1.46 KB

Versions: 49

Compression:

Stored size: 1.46 KB

Contents

# -*- encoding : utf-8 -*-
class Card; module Set; class All; module Export; extend Card::Set
# ~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/core/set/all/export.rb ~~
format :json do
  def default_export_args args
    args[:count] ||= 0
    args[:count] += 1
    args[:processed_keys] ||= ::Set.new
  end

  # export the card itself and all nested content (up to 10 levels deep)
  view :export do |args|
    # avoid loops
    return [] if args[:count] > 10 || args[:processed_keys].include?(card.key)
    args[:processed_keys] << card.key

    Array.wrap(render_atom(args)).concat(
      render_export_items(count: args[:count])
    )
  end

  def default_export_items_args args
    args[:processed_keys] ||= ::Set.new
  end

  # export all nested content (up to 10 levels deep)
  view :export_items do |args|
    result = []
    each_nested_chunk do |chunk|
      next if main_nest? chunk
      next unless (r_card = chunk.referee_card)
      next if r_card.new? || r_card == card
      next if args[:processed_keys].include?(r_card.key)
      result << r_card
    end
    result.uniq!
    result.map! { |ca| subformat(ca).render_export(args) }
    result.flatten.reject(&:blank?)
  end

  def main_nest? chunk
    chunk.respond_to?(:options) && chunk.options && chunk.options[:inc_name] &&
      chunk.options[:inc_name] == "_main"
  end
end


# ~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/core/set/all/export.rb ~~
end;end;end;end;

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
card-1.20.1 tmpsets/set/mod001-core/all/export.rb
card-1.20.0 tmpsets/set/mod001-core/all/export.rb
card-1.19.6 tmpsets/set/mod001-core/all/export.rb
card-1.19.5 tmpsets/set/mod001-core/all/export.rb
card-1.19.4 tmpsets/set/mod001-core/all/export.rb
card-1.19.3 tmpsets/set/mod001-core/all/export.rb
card-1.19.2 tmpsets/set/mod001-core/all/export.rb
card-1.19.1 tmpsets/set/mod002-core/all/export.rb
card-1.19.0 tmpsets/set/mod001-core/all/export.rb