Module: HTMLNotes

Defined in:
lib/html_notes.rb,
lib/html_notes/parser.rb,
lib/html_notes/version.rb

Defined Under Namespace

Modules: Version Classes: Parser

Class Method Summary collapse

Class Method Details

.notation_namesObject



23
24
25
# File 'lib/html_notes.rb', line 23

def notation_names
  @rows.map(&:notation).uniq
end

.output_htmlObject



13
14
15
16
17
18
19
20
21
# File 'lib/html_notes.rb', line 13

def output_html
  require 'erubis'
  template = File.read(File.join(File.dirname(__FILE__), "..", "assets", "template.html.erb"))

  File.open("notes.html", "w+") do |file|
    eruby = Erubis::Eruby.new(template)
    file.puts eruby.evaluate(:rows => @rows, :notation_names => notation_names)
  end
end

.startObject



6
7
8
9
10
11
# File 'lib/html_notes.rb', line 6

def start
  @rows = `notes`.split("\n").inject([]) do |rows, line|
    rows << HTMLNotes::Parser.new(line)
  end
  output_html
end