lib/pdfgen.rb in pdfgen-0.2.1 vs lib/pdfgen.rb in pdfgen-0.3.0
- old
+ new
@@ -12,10 +12,11 @@
def initialize(html)
@html = html
@viewport_options = nil
@emulate_media = nil
@launch_options = Hash.new
+ @wait_for_timeout = nil
end
def set_viewport(viewport_options)
@viewport_options = viewport_options
self
@@ -26,9 +27,15 @@
self
end
def launch_options(launch_options)
@launch_options = launch_options
+ self
+ end
+
+ def wait_for_timeout(wait_for_timeout)
+ raise TypeError.new("Timeout must be an integer or respond to #to_i") unless wait_for_timeout.kind_of?(Integer) || (wait_for_timeout.respond_to?(:to_i) && wait_for_timeout.to_i)
+ @wait_for_timeout = wait_for_timeout
self
end
def to_pdf(opts = {})
stdin_options = { pdf_options: opts, current_path: Dir.pwd, launch_options: @launch_options }
\ No newline at end of file