Module: Viewmd

Defined in:
lib/viewmd.rb,
lib/viewmd/version.rb

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.view(name) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/viewmd.rb', line 7

def self.view(name)
  Tempfile.create(['viewmd','.htm'],Dir.tmpdir,File::CREAT|File::TRUNC|File::RDWR, 0600) do |f|
    f << GitHub::Markup.render(name, File.read(name))
    f.flush
    Launchy.open(f.path) 
    # joining the launchy thread doesn't help to wait for browser to close before deleting the file
    # so, let's just wait a little
    sleep 2
  end
end