Merge branch 'dev' into feature/preserve-scanned-titles

This commit is contained in:
Alex Ling
2021-09-15 08:58:24 +00:00
4 changed files with 65 additions and 83 deletions
+2 -11
View File
@@ -100,14 +100,14 @@ class Library
titles.flat_map &.deep_entries
end
def to_slim_json : String
def build_json(*, slim = false, shallow = false)
JSON.build do |json|
json.object do
json.field "dir", @dir
json.field "titles" do
json.array do
self.titles.each do |title|
json.raw title.to_slim_json
json.raw title.build_json(slim: slim, shallow: shallow)
end
end
end
@@ -115,15 +115,6 @@ class Library
end
end
def to_json(json : JSON::Builder)
json.object do
json.field "dir", @dir
json.field "titles" do
json.raw self.titles.to_json
end
end
end
def get_title(tid)
@title_hash[tid]?
end