Class: GetHtml

Inherits:
Object
  • Object
show all
Defined in:
lib/html_ina.rb

Instance Method Summary collapse

Instance Method Details

#get(content, bypass_html: false, file_name: 'index.html') ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/html_ina.rb', line 2

def get(content, bypass_html: false, file_name: 'index.html')
  paste = content.gsub(/[<>]/, '') unless bypass_html

  File.open(file_name, 'w+') do |f|
    html = <<~HTML
      <!doctype html>
      <html lang="en">
      <head>
          <meta charset="UTF-8">
          <title>#{file_name}</title>
      </head>
      <body>
          <div class="info">
              #{content}
          </div>
      </body>
      </html>
    HTML
    f.write(html)
  end
end