class Lookbook::Parser

Constants

YARDOC_FILE_PATH

Public Class Methods

define_tags() click to toggle source
# File lib/lookbook/parser.rb, line 27
def define_tags
  YARD::Tags::Library.define_tag("Hidden status", :hidden)
  YARD::Tags::Library.define_tag("Label", :label)
end
new(paths) click to toggle source
# File lib/lookbook/parser.rb, line 7
def initialize(paths)
  @paths = paths.map { |p| "#{p}/**/*.rb" }
  YARD::Registry.yardoc_file = YARDOC_FILE_PATH
end

Public Instance Methods

get_code_object(path) click to toggle source
# File lib/lookbook/parser.rb, line 20
def get_code_object(path)
  registry = YARD::RegistryStore.new
  registry.load!(YARDOC_FILE_PATH)
  registry.get(path)
end
parse() click to toggle source
# File lib/lookbook/parser.rb, line 12
def parse
  YARD::Registry.clear
  YARD::Registry.lock_for_writing do
    YARD.parse(@paths)
    YARD::Registry.save(false, YARDOC_FILE_PATH)
  end
end