Class: Gauge::GaugeScreenshot
- Inherits:
-
Object
- Object
- Gauge::GaugeScreenshot
- Defined in:
- lib/gauge_screenshot.rb
Class Method Summary collapse
Instance Method Summary collapse
- #capture ⇒ Object
- #capture_to_file ⇒ Object
- #clear ⇒ Object
- #get ⇒ Object
-
#initialize ⇒ GaugeScreenshot
constructor
A new instance of GaugeScreenshot.
- #pending_screenshot ⇒ Object
Constructor Details
#initialize ⇒ GaugeScreenshot
Returns a new instance of GaugeScreenshot.
15 16 17 |
# File 'lib/gauge_screenshot.rb', line 15 def initialize @screenshots = [] end |
Class Method Details
.instance ⇒ Object
19 20 21 |
# File 'lib/gauge_screenshot.rb', line 19 def self.instance @gauge_screenshots ||= GaugeScreenshot.new end |
Instance Method Details
#capture ⇒ Object
23 24 25 |
# File 'lib/gauge_screenshot.rb', line 23 def capture @screenshots.push(capture_to_file) end |
#capture_to_file ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/gauge_screenshot.rb', line 27 def capture_to_file unless Configuration.instance.screenshot_writer? content = Configuration.instance.screengrabber.call file_name = Util.unique_screenshot_file File.write(file_name, content) return File.basename(file_name) end Configuration.instance.screengrabber.call end |
#clear ⇒ Object
47 48 49 |
# File 'lib/gauge_screenshot.rb', line 47 def clear @screenshots = [] end |
#get ⇒ Object
43 44 45 |
# File 'lib/gauge_screenshot.rb', line 43 def get @screenshots end |
#pending_screenshot ⇒ Object
37 38 39 40 41 |
# File 'lib/gauge_screenshot.rb', line 37 def pending_screenshot pending_screenshot = @screenshots clear pending_screenshot end |