Class: Compaa::GeneratedImage
- Inherits:
-
Struct
- Object
- Struct
- Compaa::GeneratedImage
- Defined in:
- lib/compaa/generated_image.rb
Instance Attribute Summary collapse
-
#file_manager ⇒ Object
writeonly
Sets the attribute file_manager.
-
#path ⇒ Object
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
- #create_reference_image ⇒ Object
- #delete ⇒ Object
- #delete_difference_image ⇒ Object
- #has_reference_image? ⇒ Boolean
- #reference_path ⇒ Object
Instance Attribute Details
#file_manager=(value) ⇒ Object
Sets the attribute file_manager
5 6 7 |
# File 'lib/compaa/generated_image.rb', line 5 def file_manager=(value) @file_manager = value end |
#path ⇒ Object
Returns the value of attribute path
4 5 6 |
# File 'lib/compaa/generated_image.rb', line 4 def path @path end |
Class Method Details
.all ⇒ Object
7 8 9 10 11 |
# File 'lib/compaa/generated_image.rb', line 7 def self.all Dir.glob(File.join %w[artifacts screenshots_generated_this_run ** *.png]).map { |path| new path } end |
Instance Method Details
#create_reference_image ⇒ Object
13 14 15 |
# File 'lib/compaa/generated_image.rb', line 13 def create_reference_image copy_and_create_directory reference_path end |
#delete ⇒ Object
31 32 33 |
# File 'lib/compaa/generated_image.rb', line 31 def delete file_manager.rm path end |
#delete_difference_image ⇒ Object
25 26 27 28 29 |
# File 'lib/compaa/generated_image.rb', line 25 def delete_difference_image difference_image_path = path.gsub 'screenshots_generated_this_run', 'differences_in_screenshots_this_run' difference_image_path << '_difference.gif' file_manager.rm difference_image_path, force: true end |
#has_reference_image? ⇒ Boolean
17 18 19 |
# File 'lib/compaa/generated_image.rb', line 17 def has_reference_image? File.exists? reference_path end |
#reference_path ⇒ Object
21 22 23 |
# File 'lib/compaa/generated_image.rb', line 21 def reference_path path.gsub 'screenshots_generated_this_run', 'reference_screenshots' end |