Class: ChupaText::Screenshot

Inherits:
Object
  • Object
show all
Defined in:
lib/chupa-text/screenshot.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mime_type, data, encoding = nil) ⇒ Screenshot



31
32
33
34
35
# File 'lib/chupa-text/screenshot.rb', line 31

def initialize(mime_type, data, encoding=nil)
  @mime_type = mime_type
  @data = data
  @encoding = encoding
end

Instance Attribute Details

#dataString (readonly)



23
24
25
# File 'lib/chupa-text/screenshot.rb', line 23

def data
  @data
end

#encodingString? (readonly)



29
30
31
# File 'lib/chupa-text/screenshot.rb', line 29

def encoding
  @encoding
end

#mime_typeString (readonly)



20
21
22
# File 'lib/chupa-text/screenshot.rb', line 20

def mime_type
  @mime_type
end

Instance Method Details

#decoded_dataObject



37
38
39
40
41
42
43
44
# File 'lib/chupa-text/screenshot.rb', line 37

def decoded_data
  case @encoding
  when "base64"
    @data.unpack("m*")[0]
  else
    @data
  end
end