Use depth instead of shallow in API

This commit is contained in:
Alex Ling
2021-09-22 09:17:14 +00:00
parent 72fae7f5ed
commit 974b6cfe9b
3 changed files with 29 additions and 20 deletions
+2 -2
View File
@@ -97,14 +97,14 @@ class Library
titles.flat_map &.deep_entries
end
def build_json(*, slim = false, shallow = false)
def build_json(*, slim = false, depth = -1)
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.build_json(slim: slim, shallow: shallow)
json.raw title.build_json(slim: slim, depth: depth)
end
end
end