Class: Bookshelf::Parser::Base
- Inherits:
-
Object
- Object
- Bookshelf::Parser::Base
- Defined in:
- lib/bookshelf/parser.rb
Instance Attribute Summary collapse
-
#book_dir ⇒ Object
The e-book directory.
Class Method Summary collapse
Instance Method Summary collapse
-
#config ⇒ Object
Return the configuration file.
-
#initialize(book_dir) ⇒ Base
constructor
A new instance of Base.
-
#name ⇒ Object
Return directory’s basename.
- #spawn_command(cmd) ⇒ Object
Constructor Details
#initialize(book_dir) ⇒ Base
Returns a new instance of Base.
18 19 20 |
# File 'lib/bookshelf/parser.rb', line 18 def initialize(book_dir) @book_dir = Pathname.new(book_dir) end |
Instance Attribute Details
#book_dir ⇒ Object
The e-book directory.
12 13 14 |
# File 'lib/bookshelf/parser.rb', line 12 def book_dir @book_dir end |
Class Method Details
.parse(book_dir) ⇒ Object
14 15 16 |
# File 'lib/bookshelf/parser.rb', line 14 def self.parse(book_dir) new(book_dir).parse end |
Instance Method Details
#config ⇒ Object
Return the configuration file.
30 31 32 |
# File 'lib/bookshelf/parser.rb', line 30 def config Bookshelf.config end |
#name ⇒ Object
Return directory’s basename.
24 25 26 |
# File 'lib/bookshelf/parser.rb', line 24 def name File.basename(Bookshelf.root_dir) end |
#spawn_command(cmd) ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# 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. else puts stdout_and_stderr unless status.success? status.success? end end |