Class: Zim::Url

Inherits:
Object
  • Object
show all
Defined in:
lib/zim2epub/zim_ext.rb

Instance Method Summary collapse

Instance Method Details

#extObject



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/zim2epub/zim_ext.rb', line 3

def ext
  case @mime_type
  when 'text/html'
    'html'
  when 'image/png'
    'png'
  when 'image/jpeg'
    'jpg'
  else
    raise "Unsupported mime type: #{self.mime_type}"
  end
end

#filenameObject



16
17
18
# File 'lib/zim2epub/zim_ext.rb', line 16

def filename
  "#{@url.gsub(/[^a-zA-Z0-9._\-]+/, '_')}.#{ext}"
end