Class: Uniword::Mhtml::ImagePart

Inherits:
MimePart
  • Object
show all
Defined in:
lib/uniword/mhtml/image_part.rb

Overview

Image MIME part — embedded image (PNG, JPEG, GIF, etc.)

Instance Method Summary collapse

Methods inherited from MimePart

#decoded_content, #decoded_content=, #filename, #html_content?, #image_content?, #text_content?, #theme_content?, #xml_content?

Instance Method Details

#image_dataObject



7
8
9
# File 'lib/uniword/mhtml/image_part.rb', line 7

def image_data
  decoded_content
end

#image_data=(value) ⇒ Object



11
12
13
# File 'lib/uniword/mhtml/image_part.rb', line 11

def image_data=(value)
  self.raw_content = value
end

#image_formatObject



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/uniword/mhtml/image_part.rb', line 15

def image_format
  case content_type
  when /png/i then :png
  when /jpeg|jpg/i then :jpeg
  when /gif/i then :gif
  when /bmp/i then :bmp
  when /tiff/i then :tiff
  when /svg/i then :svg
  when /webp/i then :webp
  else :unknown
  end
end