class Bookshelf::Parser::Base

Attributes

book_dir[RW]

The e-book directory.

Public Class Methods

new(book_dir) click to toggle source
# File lib/bookshelf/parser.rb, line 18
def initialize(book_dir)
  @book_dir = Pathname.new(book_dir)
end
parse(book_dir) click to toggle source
# File lib/bookshelf/parser.rb, line 14
def self.parse(book_dir)
  new(book_dir).parse
end

Public Instance Methods

config() click to toggle source

Return the configuration file.

# File lib/bookshelf/parser.rb, line 30
def config
  Bookshelf.config
end
name() click to toggle source

Return directory’s basename.

# File lib/bookshelf/parser.rb, line 24
def name
  File.basename(Bookshelf.root_dir)
end
spawn_command(cmd) click to toggle source
# File lib/bookshelf/parser.rb, line 34
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