Sha256: 5bd6c74dc79b1933b1ee130161f05902c0a861c194812ec493f6ab5a3767932b

Contents?: true

Size: 831 Bytes

Versions: 13

Compression:

Stored size: 831 Bytes

Contents

require "yard"

module Lookbook
  class Parser
    YARDOC_FILE_PATH = Rails.root.join("tmp/storage/.yardoc").to_s

    def initialize(paths)
      @paths = paths.map { |p| "#{p}/**/*preview.rb" }
      YARD::Registry.yardoc_file = YARDOC_FILE_PATH
    end

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

    def get_code_object(path)
      registry = YARD::RegistryStore.new
      registry.load!(YARDOC_FILE_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)
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
lookbook-0.6.1 lib/lookbook/parser.rb
lookbook-0.6.0 lib/lookbook/parser.rb
lookbook-0.5.2 lib/lookbook/parser.rb
lookbook-0.5.1 lib/lookbook/parser.rb
lookbook-0.5.0 lib/lookbook/parser.rb
lookbook-0.5.0.beta.2 lib/lookbook/parser.rb
lookbook-0.5.0.beta.1 lib/lookbook/parser.rb
lookbook-0.5.0.beta.0 lib/lookbook/parser.rb
lookbook-0.4.8 lib/lookbook/parser.rb
lookbook-0.4.7 lib/lookbook/parser.rb
lookbook-0.4.6 lib/lookbook/parser.rb
lookbook-0.4.5 lib/lookbook/parser.rb
lookbook-0.4.4 lib/lookbook/parser.rb