You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
devdocs/lib/docs/core/manifest.rb

35 lines
548 B

11 years ago
require 'yajl/json_gem'
module Docs
class Manifest
FILENAME = 'docs.json'
def initialize(store, docs)
@store = store
@docs = docs
end
def store
@store.write FILENAME, to_json
end
def as_json
indexed_docs.map(&:as_json).each do |json|
json[:mtime] = @store.mtime(json[:index_path]).to_i
end
end
def to_json
JSON.generate(as_json)
end
private
def indexed_docs
@docs.select do |doc|
@store.exist? doc.index_path
end
end
end
end