Module: Card::Set::Abstract::Pointer::OtherViews::JsonFormat

Extended by:
Card::Set::AbstractFormat
Defined in:
card/tmpsets/set/mod009-card-mod-list/abstract/01_pointer/other_views.rb,
card/tmpsets/set/mod008-card-mod-list/abstract/01_pointer/other_views.rb

Overview

JSON views

Instance Method Summary collapse

Instance Method Details

#essentialsObject



72
73
74
75
76
77
# File 'card/tmpsets/set/mod009-card-mod-list/abstract/01_pointer/other_views.rb', line 72

def essentials
  return {} if depth > max_depth
  card.item_cards.map do |item|
    nest item, view: :essentials
  end
end

#item_cardsObject



60
61
62
# File 'card/tmpsets/set/mod009-card-mod-list/abstract/01_pointer/other_views.rb', line 60

def item_cards
  card.item_cards
end

#items_for_exportObject



68
69
70
# File 'card/tmpsets/set/mod009-card-mod-list/abstract/01_pointer/other_views.rb', line 68

def items_for_export
  card.item_cards
end

#max_depthObject



64
65
66
# File 'card/tmpsets/set/mod009-card-mod-list/abstract/01_pointer/other_views.rb', line 64

def max_depth
  params[:max_depth] || 1
end

#view: contentObject



56
57
58
# File 'card/tmpsets/set/mod009-card-mod-list/abstract/01_pointer/other_views.rb', line 56

view :content do
  card.item_names
end


79
80
81
# File 'card/tmpsets/set/mod009-card-mod-list/abstract/01_pointer/other_views.rb', line 79

view :links do
  []
end