Sha256: 9053aa1e3f73d7734fba65959d25701293047dc31fc4ba64108531988df63b36

Contents?: true

Size: 764 Bytes

Versions: 12

Compression:

Stored size: 764 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}/**/*.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)
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
lookbook-0.3.3 lib/lookbook/parser.rb
lookbook-0.3.2 lib/lookbook/parser.rb
lookbook-0.3.1 lib/lookbook/parser.rb
lookbook-0.3.0 lib/lookbook/parser.rb
lookbook-0.3.0.beta.2 lib/lookbook/parser.rb
lookbook-0.3.0.beta.1 lib/lookbook/parser.rb
lookbook-0.3.0.beta.0 lib/lookbook/parser.rb
lookbook-0.2.4 lib/lookbook/parser.rb
lookbook-0.2.3 lib/lookbook/parser.rb
lookbook-0.2.2 lib/lookbook/parser.rb
lookbook-0.2.1 lib/lookbook/parser.rb
lookbook-0.2.0 lib/lookbook/parser.rb