Sha256: cb21dd2b194c9fa1c98418f3e94df712e8d7a9a456432f47051905d104dd49e6
Contents?: true
Size: 617 Bytes
Versions: 1
Compression:
Stored size: 617 Bytes
Contents
# frozen_string_literal: true require_relative 'epub2mobi/version' # Epub to Mobi file type converter # It's based on calibre-ebook converter, so you need to install it module Epub2mobi CONVERT_APP = ENV.fetch('CONVERT_APP', 'ebook-convert') private_constant :CONVERT_APP class ConverterMissingError < StandardError; end class << self def convert(from:, to:) raise ConverterMissingError unless app_installed? system "#{CONVERT_APP} #{from} #{to}" end private def app_installed? bin_path = `command -v #{CONVERT_APP}`.chomp File.exist? bin_path end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
epub2mobi-0.1.0 | lib/epub2mobi.rb |