Class: Klipbook::Sources::Source

Inherits:
Object
  • Object
show all
Defined in:
lib/klipbook/sources/source.rb

Class Method Summary collapse

Class Method Details

.build(options) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/klipbook/sources/source.rb', line 4

def self.build(options)
  if options.from_file
    file_source(options.from_file, options.count)
  else
    raise "Unknown source type"
  end
end

.file_source(file, max_books) ⇒ Object



12
13
14
# File 'lib/klipbook/sources/source.rb', line 12

def self.file_source(file, max_books)
  Sources::KindleDevice::File.new(File.read(file), max_books)
end