Slim option in library and title APIs

This commit is contained in:
Alex Ling
2021-04-25 12:39:08 +00:00
parent 7f0c256fe6
commit cd8944ed2d
4 changed files with 80 additions and 4 deletions

View File

@@ -85,6 +85,21 @@ class Library
titles + titles.flat_map &.deep_titles
end
def to_slim_json : String
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
end
end
end
end
end
end
def to_json(json : JSON::Builder)
json.object do
json.field "dir", @dir