Class: Retter::Stationery::Previewer

Inherits:
Object
  • Object
show all
Defined in:
lib/retter/stationery/previewer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(date, config) ⇒ Previewer

Returns a new instance of Previewer.



7
8
9
10
11
12
13
# File 'lib/retter/stationery/previewer.rb', line 7

def initialize(date, config)
  @config, @date = config, date
  @body, @entry  = *nil

  load_retter_file
  load_wip_entry_if_needed
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



5
6
7
# File 'lib/retter/stationery/previewer.rb', line 5

def config
  @config
end

Instance Method Details

#entry_rendererObject



23
24
25
# File 'lib/retter/stationery/previewer.rb', line 23

def entry_renderer
  Haml::Engine.new(config.entry_layout_file.read, ugly: true)
end

#file_pathObject



15
16
17
# File 'lib/retter/stationery/previewer.rb', line 15

def file_path
  config.retter_home.join '.preview.html'
end


27
28
29
30
# File 'lib/retter/stationery/previewer.rb', line 27

def print
  build_entry
  print_html 
end

#rendererObject



19
20
21
# File 'lib/retter/stationery/previewer.rb', line 19

def renderer
  Haml::Engine.new(config.layout_file.read, ugly: true)
end