Sha256: 6ed821aa13545612d27ab3159ae442ec0905d9802958005df839176dae68a641
Contents?: true
Size: 1.32 KB
Versions: 4
Compression:
Stored size: 1.32 KB
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(custom = {}) YARD::Tags::Library.define_tag("Hidden status", :hidden) YARD::Tags::Library.define_tag("Label", :label) YARD::Tags::Library.define_tag("Display", :display) YARD::Tags::Library.define_tag("Position", :position) YARD::Tags::Library.define_tag("ID", :id) YARD::Tags::Library.define_tag("Component", :component) custom.each do |name, opts| YARD::Tags::Library.define_tag(name.to_s.titleize, name) end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
lookbook-1.0.8 | lib/lookbook/parser.rb |
lookbook-1.0.7 | lib/lookbook/parser.rb |
lookbook-1.0.6 | lib/lookbook/parser.rb |
lookbook-1.0.5 | lib/lookbook/parser.rb |