Class: DocTypeChecker::Store

Inherits:
Object
  • Object
show all
Defined in:
lib/doc_type_checker/store.rb

Overview

DocTypeChecker::Store

Instance Method Summary collapse

Constructor Details

#initializeDocTypeChecker::Store


7
8
9
# File 'lib/doc_type_checker/store.rb', line 7

def initialize
  reload!
end

Instance Method Details

#fetch(class_name, method_name) ⇒ DocTypeChecker::Definition

Parameters:

  • class_name (String)
  • method_name (String)

Returns:


14
15
16
# File 'lib/doc_type_checker/store.rb', line 14

def fetch(class_name, method_name)
  @definitions.fetch(class_name, nil)&.fetch(method_name, nil)
end

#reload!Hash<String, Hash<String, DocTypeChecker::Definition>>

Returns:


19
20
21
22
23
24
25
26
27
28
# File 'lib/doc_type_checker/store.rb', line 19

def reload!
  @definitions = YARD::Registry.load!.all(:class).to_h do |klass|
    [
      klass.path,
      klass.meths.to_h do |meth|
        [meth.name(true), DocTypeChecker::Definition.new(meth)]
      end
    ]
  end
end