Class: Rundoc::CodeCommand::Website::ScreenshotRunner
- Inherits:
-
Object
- Object
- Rundoc::CodeCommand::Website::ScreenshotRunner
- Defined in:
- lib/rundoc/code_command/website/screenshot.rb
Instance Attribute Summary collapse
-
#io ⇒ Object
readonly
Returns the value of attribute io.
Instance Method Summary collapse
- #call(env = {}) ⇒ Object
- #driver ⇒ Object
-
#initialize(user_args:, render_command:, render_result:, io:, contents: nil) ⇒ ScreenshotRunner
constructor
A new instance of ScreenshotRunner.
- #to_md(env = {}) ⇒ Object
Constructor Details
#initialize(user_args:, render_command:, render_result:, io:, contents: nil) ⇒ ScreenshotRunner
Returns a new instance of ScreenshotRunner.
16 17 18 19 20 21 |
# File 'lib/rundoc/code_command/website/screenshot.rb', line 16 def initialize(user_args:, render_command:, render_result:, io:, contents: nil) @name = user_args.name @upload = user_args.upload @driver = nil @io = io end |
Instance Attribute Details
#io ⇒ Object (readonly)
Returns the value of attribute io.
14 15 16 |
# File 'lib/rundoc/code_command/website/screenshot.rb', line 14 def io @io end |
Instance Method Details
#call(env = {}) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/rundoc/code_command/website/screenshot.rb', line 31 def call(env = {}) io.puts "Taking screenshot: #{driver.current_url}" filename = driver.screenshot( upload: @upload, screenshots_dir: env[:context].screenshots_dir ) relative_filename = filename.relative_path_from(env[:context].output_dir) env[:before] << "" "" end |
#driver ⇒ Object
23 24 25 |
# File 'lib/rundoc/code_command/website/screenshot.rb', line 23 def driver @driver ||= Rundoc::CodeCommand::Website::Driver.find(@name) end |
#to_md(env = {}) ⇒ Object
27 28 29 |
# File 'lib/rundoc/code_command/website/screenshot.rb', line 27 def to_md(env = {}) "" end |