Class: DeklarativnaUtils::HTMLExporter

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

Constant Summary collapse

@@default_filename =
'rendered_html.html'

Instance Method Summary collapse

Instance Method Details

#launch_file_on_browser(filename_or_url) ⇒ Object

Requires Firefox or Chrome



13
14
15
# File 'lib/deklarativna_utils.rb', line 13

def launch_file_on_browser filename_or_url
  Launchy.open filename_or_url
end

#launch_rendered_html_on_browser(rendered_html, filename = nil) ⇒ Object

Requires Firefox or Chrome



18
19
20
21
22
23
24
# File 'lib/deklarativna_utils.rb', line 18

def launch_rendered_html_on_browser rendered_html, filename=nil
  filename ||= @@default_filename
  launch_file_on_browser(
    render_to_file filename,
    rendered_html
  )
end

#render_to_file(filename, rendered_html) ⇒ Object



7
8
9
10
# File 'lib/deklarativna_utils.rb', line 7

def render_to_file filename, rendered_html
  File.open(filename, 'w') { |f| f.write(rendered_html) }
  filename
end