Class: EbookLibrary::EbookFactory
- Inherits:
-
Object
- Object
- EbookLibrary::EbookFactory
- Defined in:
- lib/ebook_library/ebook_factory.rb
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
Class Method Summary collapse
Instance Method Summary collapse
- #author ⇒ Object
-
#initialize(format, metadata) ⇒ EbookFactory
constructor
A new instance of EbookFactory.
- #title ⇒ Object
Constructor Details
#initialize(format, metadata) ⇒ EbookFactory
Returns a new instance of EbookFactory.
5 6 7 8 |
# File 'lib/ebook_library/ebook_factory.rb', line 5 def initialize(format, ) raise UnsupportedFormatError unless %w(epub mobi pdf).include? format @adapter = for_type(format).new() end |
Instance Attribute Details
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
4 5 6 |
# File 'lib/ebook_library/ebook_factory.rb', line 4 def adapter @adapter end |
Class Method Details
.supported_types ⇒ Object
10 11 12 |
# File 'lib/ebook_library/ebook_factory.rb', line 10 def self.supported_types %w(epub mobi pdf) end |
Instance Method Details
#author ⇒ Object
18 19 20 |
# File 'lib/ebook_library/ebook_factory.rb', line 18 def Maybe(adapter).._("").encode('UTF-8', ) end |
#title ⇒ Object
14 15 16 |
# File 'lib/ebook_library/ebook_factory.rb', line 14 def title Maybe(adapter).title._("untitled").encode('UTF-8', ) end |