Class: Applitools::Screenshot::Image

Inherits:
Applitools::Screenshot show all
Defined in:
lib/applitools/core/screenshot.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#imageObject (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

#sha256Object



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