Class: Retter::Stationery::Previewer
- Inherits:
-
Object
- Object
- Retter::Stationery::Previewer
- Defined in:
- lib/retter/stationery/previewer.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #entry_renderer ⇒ Object
- #file_path ⇒ Object
-
#initialize(date, config) ⇒ Previewer
constructor
A new instance of Previewer.
- #print ⇒ Object
- #renderer ⇒ Object
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
#config ⇒ Object (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_renderer ⇒ Object
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_path ⇒ Object
15 16 17 |
# File 'lib/retter/stationery/previewer.rb', line 15 def file_path config.retter_home.join '.preview.html' end |
#print ⇒ Object
27 28 29 30 |
# File 'lib/retter/stationery/previewer.rb', line 27 def print build_entry print_html end |
#renderer ⇒ Object
19 20 21 |
# File 'lib/retter/stationery/previewer.rb', line 19 def renderer Haml::Engine.new(config.layout_file.read, ugly: true) end |