class Danger::UndocumentedReader

Reads undocumented.json file created by jazzy

Public Class Methods

new(path) click to toggle source
# File lib/jazzy/undocumented_reader.rb, line 4
def initialize(path)
  load(path)
end

Public Instance Methods

undocumented_symbols() click to toggle source
# File lib/jazzy/undocumented_reader.rb, line 8
def undocumented_symbols
  @data['warnings'].map do |item|
    next unless item_valid? item
    Symbol.new(
      item_file(item),
      item['line'],
      item['symbol'],
      item['symbol_kind'],
      item['warning']
    )
  end
end

Private Instance Methods

item_file(item) click to toggle source
# File lib/jazzy/undocumented_reader.rb, line 28
def item_file(item)
  file = item['file']
  return unless file
  path = Pathname.new(file)
  path.relative_path_from(@working_path).to_s
end
item_valid?(item) click to toggle source
# File lib/jazzy/undocumented_reader.rb, line 35
def item_valid?(item)
  item['warning'] == 'undocumented'
end
load(path) click to toggle source
# File lib/jazzy/undocumented_reader.rb, line 23
def load(path)
  @data = JSON.parse(File.read(path))
  @working_path = Pathname.new(@data['source_directory'])
end