Sha256: 0f65c50a05a21a7e04d69c2b9a8267ef91b47156d0ace747731f338c711295a2

Contents?: true

Size: 954 Bytes

Versions: 6

Compression:

Stored size: 954 Bytes

Contents

require "yard"

module Lookbook
  class Parser
    attr_reader :registry_path
    def initialize(paths, registry_path)
      @paths = paths.map { |p| "#{p}/**/*preview.rb" }
      @registry_path = registry_path.to_s
      YARD::Registry.yardoc_file = registry_path
    end

    def parse
      YARD::Registry.clear
      YARD::Registry.lock_for_writing do
        YARD.parse(@paths)
        YARD::Registry.save(false, registry_path)
      end
    end

    def get_code_object(path)
      registry = YARD::RegistryStore.new
      registry.load!(registry_path)
      registry.get(path)
    end

    class << self
      def define_tags
        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)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
lookbook-0.9.8 lib/lookbook/parser.rb
lookbook-0.9.7 lib/lookbook/parser.rb
lookbook-0.9.6 lib/lookbook/parser.rb
lookbook-0.9.5 lib/lookbook/parser.rb
lookbook-0.9.4 lib/lookbook/parser.rb
lookbook-0.9.3 lib/lookbook/parser.rb