12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/rubylens/showcase_model.rb', line 12
def call(model)
{
"schema" => "rubylens.showcase.v1",
"projectName" => model.fetch("projectName"),
"totals" => project_hash(model.fetch("totals"), TOTAL_FIELDS),
"domains" => project_hash(model.fetch("domains"), SIGNAL_FIELDS),
"categoryStats" => CATEGORY_FIELDS.to_h do |category|
[category, numeric_row(model.fetch("categoryStats").fetch(category), 4)]
end,
"namespaces" => model.fetch("namespaces").map { |row| numeric_row(row, 15) },
"packages" => model.fetch("packages").map { |row| numeric_row(row, 8) },
"dependencyStars" => model.fetch("dependencyStars").map { |row| numeric_row(row, 8) },
}
end
|