Sha256: cfd6f8421f0d82bb131dac7b7b95bee2e1945a7a6f4b9e27d481db17921e631f
Contents?: true
Size: 626 Bytes
Versions: 1
Compression:
Stored size: 626 Bytes
Contents
# Represents a book's introduction module Epubber::Models class Cover def initialize @file = nil end def file(image = nil) if image @file = image else @file end end def filename File.basename(@file.path) end def file_mime if /(?:jpg|jpeg)/ =~ filename 'image/jpeg' elsif /(?:png)/ =~ filename 'image/png' else raise 'Invalid file type: Only JPG and PNG images are allowed.' end end def contextify { 'filename' => filename, 'file' => file, 'file_mime' => file_mime } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
epubber-0.2.0 | lib/epubber/models/cover.rb |