Class: Furikake::Formatters::Markdown

Inherits:
Object
  • Object
show all
Defined in:
lib/furikake/formatters/markdown.rb

Class Method Summary collapse

Class Method Details

.write(c) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/furikake/formatters/markdown.rb', line 7

def self.write(c)
  contents = "### <%= c[:title] %>\n\n<%- c[:resources].each do |r| -%>\n<%- if r[:subtitle] != '' -%>\n#### <%= r[:subtitle] %>\n\n<%- end -%>\n<%- if ! r[:resource].empty? -%>\n<%= MarkdownTables.make_table(r[:header], r[:resource], is_rows: true, align: 'l') %>\n\n<%- else -%>\n<%= 'N/A' %>\n\n<%- end -%>\n<%- end -%>\n"
  erb = ERB.new(contents, nil, '-')
  erb.result(binding).chomp
end