Module: GfmLivePreview

Extended by:
GfmLivePreview
Included in:
GfmLivePreview
Defined in:
lib/gfm_live_preview.rb,
lib/gfm_live_preview/cli.rb,
lib/gfm_live_preview/server.rb,
lib/gfm_live_preview/version.rb,
lib/gfm_live_preview/syntax_highlighter.rb

Defined Under Namespace

Classes: CLI, Server, SyntaxHighlighter

Constant Summary collapse

VERSION =
"0.9.7"

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file


13
14
15
# File 'lib/gfm_live_preview.rb', line 13

def file
  @file
end

Instance Method Details

#configObject


24
25
26
# File 'lib/gfm_live_preview.rb', line 24

def config
  @config ||= {}
end

#read_file(relative_path = nil) ⇒ Object


28
29
30
31
# File 'lib/gfm_live_preview.rb', line 28

def read_file(relative_path = nil)
  path = relative_path ? root.join(relative_path) : file
  File.read path
end

#rootObject


33
34
35
# File 'lib/gfm_live_preview.rb', line 33

def root
  Pathname(File.expand_path("..", file))
end

#run!(argv) ⇒ Object


18
19
20
21
22
# File 'lib/gfm_live_preview.rb', line 18

def run! argv
  @file, options = CLI.parse argv
  config.update options
  Server.run!
end