Module: Card::Set::All::Csv::CsvFormat

Extended by:
Card::Set::AbstractFormat
Defined in:
platypus/tmp/set/gem-defaults/mod004-format/all/csv.rb

Instance Method Summary collapse

Instance Method Details

#default_item_viewObject



24
25
26
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/csv.rb', line 24

def default_item_view
  :name
end

#default_nest_viewObject



20
21
22
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/csv.rb', line 20

def default_nest_view
  :titled
end

#nestsObject



16
17
18
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/csv.rb', line 16

def nests
  [["_self", { view: :name }], ["_self", { view: :type }]]
end

#show(view, args) ⇒ Object



11
12
13
14
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/csv.rb', line 11

def show view, args
  view ||= :titled
  super view, args
end

#view: bodyObject



33
34
35
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/csv.rb', line 33

view :body do
  item_cards.map { |item_card| nest item_card }
end

#view: headerObject

localize



42
43
44
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/csv.rb', line 42

view :header do
  [%w[Name Type]]
end

#view: rowObject



37
38
39
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/csv.rb', line 37

view :row do
  nests.map { |nest_args| nest(*nest_args) }
end

#view: titledObject



28
29
30
31
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/csv.rb', line 28

view :titled do
  voo.items[:view] ||= :row
  (render_header + render_body).map { |row| CSV.generate_line row }.join
end

#view: unknownObject



46
47
48
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/csv.rb', line 46

view :unknown do
  ""
end