Sha256: ca8ab5c7e6a75b8025b4180252ceed9aa561d2d0638ac74e6107f301476c5d2c

Contents?: true

Size: 619 Bytes

Versions: 27

Compression:

Stored size: 619 Bytes

Contents

module Jazzy
  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 = Hash[decls.map 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,
         }.reject { |_, v| v.nil? || v.empty? }]
      end
      ]
      File.open(File.join(output_dir, 'search.json'), 'w') do |f|
        f.write(index.to_json)
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
jazzy-0.8.4 lib/jazzy/search_builder.rb
jazzy-0.8.3 lib/jazzy/search_builder.rb
jazzy-0.8.2 lib/jazzy/search_builder.rb
jazzy-0.8.1 lib/jazzy/search_builder.rb
jazzy-0.8.0 lib/jazzy/search_builder.rb
jazzy-0.7.5 lib/jazzy/search_builder.rb
jazzy-0.7.4 lib/jazzy/search_builder.rb