Sha256: 8bae918c324dcf3efa3799bda391b2f60587275670af5fcc00c10968082e9d32

Contents?: true

Size: 564 Bytes

Versions: 2

Compression:

Stored size: 564 Bytes

Contents

module EbooksRenamer
  class EpubParser
    class << self
      using AgileUtils::BlankExt
      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
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ebooks_renamer-0.2.1 lib/ebooks_renamer/epub_parser.rb
ebooks_renamer-0.2.0 lib/ebooks_renamer/epub_parser.rb