Sha256: 6a2c29d7d3847d66f5d1cefeabd867e24eb852f4e69c324fa12d41f60f5719ff
Contents?: true
Size: 1.3 KB
Versions: 10
Compression:
Stored size: 1.3 KB
Contents
require 'open3' module Kitabu module Parser autoload :HTML , "kitabu/parser/html" autoload :PDF , "kitabu/parser/pdf" autoload :Epub , "kitabu/parser/epub" autoload :Mobi , "kitabu/parser/mobi" autoload :Txt , "kitabu/parser/txt" class Base # The e-book directory. # attr_accessor :root_dir # Where the text files are stored. # attr_accessor :source def self.parse(root_dir) new(root_dir).parse end def initialize(root_dir) @root_dir = Pathname.new(root_dir) @source = root_dir.join("text") end # Return directory's basename. # def name File.basename(root_dir) end # Return the configuration file. # def config Kitabu.config(root_dir) end # Render a eRb template using +locals+ as data seed. # def render_template(file, locals = {}) ERB.new(File.read(file)).result OpenStruct.new(locals).instance_eval{ binding } end def spawn_command(cmd) begin stdout_and_stderr, status = Open3.capture2e(*cmd) rescue Errno::ENOENT => e puts e.message else puts stdout_and_stderr unless status.success? status.success? end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems