class EbooksRenamer::EpubParser

Public Class Methods

parse(filename) click to toggle source
# File lib/ebooks_renamer/epub_parser.rb, line 4
def parse(filename)
  info = EPUBInfo.get(filename)
  if info.present?
    title     = info.titles.first if info.titles
    author    = info.creators.map(&:name).first if info.creators
    publisher = info.publisher
    if title.present?
      OpenStruct.new title:     title,
                     author:    author,
                     publisher: publisher
    end
  end
end