class KindleManager::BaseParser

Attributes

fetched_at[RW]

Public Class Methods

new(filepath, options = {}) click to toggle source
# File lib/kindle_manager/parsers/base_parser.rb, line 5
def initialize(filepath, options = {})
  @filepath = filepath

  @fetched_at = if File.basename(@filepath) =~ /\A\d{14}/
    Time.strptime(File.basename(@filepath)[0..14], KindleManager::FileStore::TIME_FORMAT_FOR_FILENAME)
  else
    File.ctime(@filepath)
  end
end

Public Instance Methods

body() click to toggle source
# File lib/kindle_manager/parsers/base_parser.rb, line 19
def body
  @body ||= File.read(@filepath)
end
doc() click to toggle source
# File lib/kindle_manager/parsers/base_parser.rb, line 15
def doc
  @doc ||= Nokogiri::HTML(body)
end