Class: HTMLSaver
- Inherits:
-
Object
- Object
- HTMLSaver
- Defined in:
- lib/html_ina.rb
Class Method Summary collapse
Class Method Details
.save(body, file_name: 'index.html', bypass_html: false) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/html_ina.rb', line 4 def self.save(body, file_name: 'index.html', bypass_html: false) body = Sanitize.fragment(body) unless bypass_html File.open(file_name, 'w+') do |f| html = " <!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <title>\#{file_name}</title>\n <meta charset=\"utf-8\">\n </head>\n <body>\n \#{body}\n </body>\n </html>\n HTML\n f.write(html)\n end\nend\n" |