Class: Applitools::Screenshot::Image
- Inherits:
-
Applitools::Screenshot
- Object
- Delegator
- Applitools::Screenshot
- Applitools::Screenshot::Image
- Defined in:
- lib/applitools/core/screenshot.rb
Instance Attribute Summary collapse
-
#image ⇒ Object
readonly
Returns the value of attribute image.
Instance Method Summary collapse
- #__getobj__ ⇒ Object
- #__setobj__(obj) ⇒ Object
-
#initialize(image) ⇒ Image
constructor
A new instance of Image.
- #sha256 ⇒ Object
- #update!(image) ⇒ Object
Methods inherited from Applitools::Screenshot
from_any_image, from_datastream, from_image, from_region, #method_missing, #respond_to_missing?, #square
Constructor Details
#initialize(image) ⇒ Image
Returns a new instance of Image.
104 105 106 107 108 |
# File 'lib/applitools/core/screenshot.rb', line 104 def initialize(image) Applitools::ArgumentGuard.not_nil(image, 'image') # Applitools::ArgumentGuard.is_a?(image, 'image', ::ChunkyPNG::Image) @image = image end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Applitools::Screenshot
Instance Attribute Details
#image ⇒ Object (readonly)
Returns the value of attribute image.
102 103 104 |
# File 'lib/applitools/core/screenshot.rb', line 102 def image @image end |
Instance Method Details
#__getobj__ ⇒ Object
116 117 118 |
# File 'lib/applitools/core/screenshot.rb', line 116 def __getobj__ @image end |
#__setobj__(obj) ⇒ Object
120 121 122 |
# File 'lib/applitools/core/screenshot.rb', line 120 def __setobj__(obj) @image = obj end |
#sha256 ⇒ Object
124 125 126 |
# File 'lib/applitools/core/screenshot.rb', line 124 def sha256 Digest::SHA2.new(256).hexdigest(@image.to_datastream.to_s) end |
#update!(image) ⇒ Object
110 111 112 113 114 |
# File 'lib/applitools/core/screenshot.rb', line 110 def update!(image) Applitools::ArgumentGuard.not_nil(image, 'image') # Applitools::ArgumentGuard.is_a?(image, 'image', ::ChunkyPNG::Image) @image = image end |