Class: EPInfo
- Inherits:
-
Object
- Object
- EPInfo
- Defined in:
- lib/epinfo.rb,
lib/epinfo/version.rb
Constant Summary collapse
- VERSION =
"1.0.1"
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.output(*args) ⇒ Object
6 7 8 9 |
# File 'lib/epinfo.rb', line 6 def self.output(*args) output = EPInfo.new output.output(*args) end |
Instance Method Details
#book_desc(book) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/epinfo.rb', line 37 def book_desc(book) cover = book.cover if cover cover = "#{cover.original_file_name}" end return "titles: \#{book.titles.join()}\ncreators: \#{book.creators.map{|c| \"\#{c.name}(\#{c.role})\"}.join(', ')}\nsubjects: \#{book.subjects.join(\", \")}\ndescription: \#{book.description}\npublisher: \#{book.publisher}\ncontributors: \#{book.contributors.map{|c| \"\#{c.name}(\#{c.role})\"}.join(', ')}\ndates: \#{book.dates.map{|d| \"\#{d.date_str}(\#{d.event})\"}.join(', ')}\nidentifiers: \#{book.identifiers.map(&:identifier).join(', ')}\nsource: \#{book.source}\nlanguages: \#{book.languages.join(', ')}\nrights: \#{book.rights}\ndrm_protected: \#{book.drm_protected}\ncover: \#{cover}\n EOB\nend\n" |
#output(*args) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/epinfo.rb', line 11 def output(*args) opts = OptionParser.new do |opts| opts. = "Usage: epinfo [filename]\n" opts.on('-h', '--help', 'Display this screen') do puts opts exit end end begin opts.parse!(args) if args.size != 1 #invalid option puts opts exit end book = EPUBInfo.get(args[0]) puts book_desc(book) rescue => e warn e end end |