class FlowNote

Constants

FLOW_DIR

Public Instance Methods

note(*body) click to toggle source
# File lib/flow_note.rb, line 8
def note(*body)
  File.open("#{FLOW_DIR}/#{Time.now.strftime("%Y-%m-%d")}.md", 'a') do |f|
    f.write "[#{Time.now} | #{body.join(' ')}]"
  end
end
show() click to toggle source
# File lib/flow_note.rb, line 15
def show
  build
  Launchy.open("file://#{FLOW_DIR}/show.html")
end

Private Instance Methods

build() click to toggle source
# File lib/flow_note.rb, line 22
def build
  notes = Dir.glob("#{FLOW_DIR}/*.md").sort[0..99]
  
  buffer = StringIO.new
  buffer << "<html><head><link rel='stylesheet' type='text/css' href='style.css'></head><body>"
  notes.each do |note|
    buffer << '<div class="note"><p>'
    buffer << File.read(note)
    buffer << '</p></div>'
  end
  buffer << '</body></html>'

  File.open("#{FLOW_DIR}/show.html", 'w') do |f|
    f.write buffer.string
  end
end