Class: HtmlConverter::Base
- Inherits:
-
Object
- Object
- HtmlConverter::Base
- Defined in:
- lib/htmlconverter/base.rb
Instance Method Summary collapse
-
#data_to(data, format = :pdf) ⇒ Object
HtmlConverter::Base.new.data_to(“hello, world”, :pdf).
-
#initialize ⇒ Base
constructor
A new instance of Base.
-
#render_content(source, renderer) ⇒ Object
HtmlConverter::Base.new.render_content(“hello, world”, HtmlConverter::Renderer::PDF.new).
-
#render_url(url, renderer) ⇒ Object
HtmlConverter::Base.new.render_url(“google.com”, HtmlConverter::Renderer::PDF.new).
-
#url_to(url, format = :pdf) ⇒ Object
HtmlConverter::Base.new.url_to(“google.com”, :pdf).
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
4 5 |
# File 'lib/htmlconverter/base.rb', line 4 def initialize end |
Instance Method Details
#data_to(data, format = :pdf) ⇒ Object
HtmlConverter::Base.new.data_to(“hello, world”, :pdf)
8 9 10 |
# File 'lib/htmlconverter/base.rb', line 8 def data_to(data, format = :pdf) render_content(data, self.create_renderer(format)) end |
#render_content(source, renderer) ⇒ Object
HtmlConverter::Base.new.render_content(“hello, world”, HtmlConverter::Renderer::PDF.new)
18 19 20 |
# File 'lib/htmlconverter/base.rb', line 18 def render_content(source, renderer) WebRenderer.new(renderer).render_content(read_content(source)) end |
#render_url(url, renderer) ⇒ Object
HtmlConverter::Base.new.render_url(“google.com”, HtmlConverter::Renderer::PDF.new)
23 24 25 |
# File 'lib/htmlconverter/base.rb', line 23 def render_url(url, renderer) WebRenderer.new(renderer).render_url(url) end |
#url_to(url, format = :pdf) ⇒ Object
HtmlConverter::Base.new.url_to(“google.com”, :pdf)
13 14 15 |
# File 'lib/htmlconverter/base.rb', line 13 def url_to(url, format = :pdf) render_url(url, self.create_renderer(format)) end |