Showing the changes to lib/docs (2 of 7 files). Show all
Unified · Split
| @@ -37,8 +37,6 @@ module Docs · 36 unmodified lines | ||
| 37 | 37 | slug: slug, |
| 38 | 38 | type: type, |
| 39 | 39 | release: release, |
| 40 | − index_path: index_path, | |
| 41 | − db_path: db_path, | |
| 42 | 40 | links: links } |
| 43 | 41 | end |
| 44 | 42 | |
| @@ -14,9 +14,11 @@ module Docs · 13 unmodified lines | ||
| 14 | 14 | end |
| 15 | 15 | |
| 16 | 16 | def as_json |
| 17 | − indexed_docs.map(&:as_json).each do |json| | |
| 18 | − json[:mtime] = doc_mtime(json) | |
| 19 | − json[:db_size] = doc_db_size(json) | |
| 17 | + indexed_docs.map do |doc| | |
| 18 | + json = doc.as_json | |
| 19 | + json[:mtime] = doc_mtime(doc) | |
| 20 | + json[:db_size] = doc_db_size(doc) | |
| 21 | + json | |
| 20 | 22 | end |
| 21 | 23 | end |
| 22 | 24 | |
| @@ -33,11 +35,11 @@ module Docs · 10 unmodified lines | ||
| 33 | 35 | end |
| 34 | 36 | |
| 35 | 37 | def doc_mtime(doc) |
| 36 | − [@store.mtime(doc[:index_path]).to_i, @store.mtime(doc[:db_path]).to_i].max | |
| 38 | + [@store.mtime(doc.index_path).to_i, @store.mtime(doc.db_path).to_i].max | |
| 37 | 39 | end |
| 38 | 40 | |
| 39 | 41 | def doc_db_size(doc) |
| 40 | − @store.size(doc[:db_path]) | |
| 42 | + @store.size(doc.db_path) | |
| 41 | 43 | end |
| 42 | 44 | end |
| 43 | 45 | end |