lib/jazzy/search_builder.rb in jazzy-0.14.1 vs lib/jazzy/search_builder.rb in jazzy-0.14.2

- old
+ new

@@ -4,19 +4,17 @@ module SearchBuilder def self.build(source_module, output_dir) decls = source_module.all_declarations.select do |d| d.type && d.name && !d.name.empty? end - index = decls.map do |d| + index = decls.to_h do |d| [d.url, { name: d.name, abstract: d.abstract && d.abstract.split(/\n/).map(&:strip).first, - parent_name: d.parent_in_code && d.parent_in_code.name, + parent_name: d.parent_in_code&.name, }.reject { |_, v| v.nil? || v.empty? }] - end.to_h - File.open(File.join(output_dir, 'search.json'), 'w') do |f| - f.write(index.to_json) end + File.write(File.join(output_dir, 'search.json'), index.to_json) end end end