class Softcover::Book::BookFile

Constants

LAST_WRITE_HORIZON

Attributes

checksum[RW]

Public Class Methods

find(path) click to toggle source
# File lib/softcover/book.rb, line 43
def self.find(path)
  @@lookup[path]
end
new(*args) click to toggle source
Calls superclass method
# File lib/softcover/book.rb, line 28
def initialize(*args)
  super
  @checksum = Digest::MD5.file(path).hexdigest
  (@@lookup ||= {})[path] = self
end

Public Instance Methods

ready?() click to toggle source
# File lib/softcover/book.rb, line 34
def ready?
  return true if Softcover::test?
  File::ctime(path).to_i < Time.now.to_i - LAST_WRITE_HORIZON
end
to_json(opts={}) click to toggle source
# File lib/softcover/book.rb, line 39
def to_json(opts={})
  { path: path, checksum: @checksum }.to_json
end