Sha256: ea0e706aa13b9d0b1388078b0c7cb402789f138e045f8e8df3060c2077aa4b95
Contents?: true
Size: 1010 Bytes
Versions: 2
Compression:
Stored size: 1010 Bytes
Contents
require "yard" module Lookbook class Parser attr_reader :registry_path def initialize(paths) @paths = paths.map { |p| "#{p}/**/*preview.rb" } @after_parse_callbacks = [] @after_parse_once_callbacks = [] @parsing = false YARD::Parser::SourceParser.after_parse_list do [*@after_parse_callbacks, *@after_parse_once_callbacks].each do |callback| callback.call(YARD::Registry) end @after_parse_once_callbacks = [] @parsing = false end end def parse(&block) unless @parsing @parsing = true @after_parse_once_callbacks << block if block YARD::Registry.clear YARD.parse(@paths) end end def after_parse(&block) @after_parse_callbacks << block end class << self def define_tags(tags = nil) tags.to_h.each do |name, tag| YARD::Tags::Library.define_tag(tag[:label], name, tag[:yard_parser]) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
lookbook-1.2.1 | lib/lookbook/parser.rb |
lookbook-1.2.0 | lib/lookbook/parser.rb |