class ChupaText::Screenshot
Attributes
data[R]
@return [String] The data of the screenshot.
encoding[R]
@return [String, nil] The encoding of the screenshot data.
`nil` means that the data is raw data. It's used for SVG data because it's text data. `"base64"` means that the data is encoded by Base64. It's used for PNG data because it's binary data.
mime_type[R]
@return [String] The MIME type of the screenshot.
Public Class Methods
new(mime_type, data, encoding=nil)
click to toggle source
# File lib/chupa-text/screenshot.rb, line 31 def initialize(mime_type, data, encoding=nil) @mime_type = mime_type @data = data @encoding = encoding end
Public Instance Methods
decoded_data()
click to toggle source
# File lib/chupa-text/screenshot.rb, line 37 def decoded_data case @encoding when "base64" @data.unpack("m*")[0] else @data end end