Method: WordTree::Disk::Library#file_type

Defined in:
lib/wordtree/disk/library.rb

#file_type(book_id, type = :raw, opts = {}) ⇒ Object

Raises:

  • (ArgumentError)


34
35
36
37
38
39
# File 'lib/wordtree/disk/library.rb', line 34

def file_type(book_id, type=:raw, opts={})
  locator = LibraryLocator.identity(book_id)
  template = FILE_TYPES[type]
  raise ArgumentError, "unable to find file type template #{type.inspect}" if template.nil?
  template % {:id => locator.id}.merge(opts)
end