Class: Applitools::Utils::ImageUtils::Screenshot
- Inherits:
-
Delegator
- Object
- Delegator
- Applitools::Utils::ImageUtils::Screenshot
show all
- Extended by:
- Forwardable
- Defined in:
- lib/applitools/utils/image_utils.rb
Instance Method Summary
collapse
Constructor Details
#initialize(image) ⇒ Screenshot
Returns a new instance of Screenshot.
103
104
105
|
# File 'lib/applitools/utils/image_utils.rb', line 103
def initialize(image)
@datastream = ChunkyPNG::Datastream.from_string image
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
124
125
126
127
128
129
130
|
# File 'lib/applitools/utils/image_utils.rb', line 124
def method_missing(method, *args, &block)
if method =~ /^.+!$/
__setobj__ super
else
super
end
end
|
Instance Method Details
#__getobj__ ⇒ Object
111
112
113
|
# File 'lib/applitools/utils/image_utils.rb', line 111
def __getobj__
restore
end
|
#__setobj__(obj) ⇒ Object
119
120
121
122
|
# File 'lib/applitools/utils/image_utils.rb', line 119
def __setobj__(obj)
@datastream = obj.to_datastream
self
end
|
115
116
117
|
# File 'lib/applitools/utils/image_utils.rb', line 115
def
@datastream.
end
|
#restore ⇒ Object
132
133
134
|
# File 'lib/applitools/utils/image_utils.rb', line 132
def restore
ChunkyPNG::Image.from_datastream @datastream
end
|
#to_blob ⇒ Object
107
108
109
|
# File 'lib/applitools/utils/image_utils.rb', line 107
def to_blob
@datastream.to_blob
end
|