Class: PageController

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

Class Method Summary collapse

Class Method Details

.greate(body, 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
22
# File 'lib/fillson22_make_html.rb', line 4

def self.greate(body, name: 'index.html', bypass_html: false)
  body = Sanitize.fragment(body) unless bypass_html
  File.open(name, "w+") do |code|
    html_code = "    <!DOCTYPE html>\n      <html lang=\"ru\">\n    <head>\n      <meta charset=\"UTF-8\">\n      <title>\u0422\u0430\u043C\u0430\u0433\u043E\u0447\u0438</title>\n    </head>\n    <body>\n      \#{body}\n      </div>\n    </body>\n    </html>\n    HTML\n        code.write(html_code)\n  end\nend\n"