Class: SaveToHtml
- Inherits:
-
Object
- Object
- SaveToHtml
- Defined in:
- lib/save_to_html.rb
Instance Method Summary collapse
- #create ⇒ Object
-
#initialize(content:, bypass_html: true, name: "index") ⇒ SaveToHtml
constructor
A new instance of SaveToHtml.
Constructor Details
#initialize(content:, bypass_html: true, name: "index") ⇒ SaveToHtml
Returns a new instance of SaveToHtml.
5 6 7 8 |
# File 'lib/save_to_html.rb', line 5 def initialize(content:, bypass_html: true, name: "index") @content = bypass_html ? Sanitize.fragment(content) : content @file_name = name + Time.now.to_s end |
Instance Method Details
#create ⇒ Object
11 12 13 14 15 |
# File 'lib/save_to_html.rb', line 11 def create File.open(@file_name + ".html", "w") do |f| f.write(template) end end |