Class: Yattho::YARD::Registry

Inherits:
Object
  • Object
show all
Extended by:
ViewComponent::TestHelpers, ViewHelper, DocsHelper
Defined in:
lib/yattho/yard/registry.rb

Overview

Wrapper around an instance of YARD::Registry that provides easy access to component documentation.

Constant Summary

Constants included from ViewHelper

ViewHelper::HELPERS

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from DocsHelper

link_to_accessibility, link_to_component, link_to_heading_practices, link_to_octicons, link_to_system_arguments_docs, link_to_typography_docs, one_of, pretty_value, status_module_and_short_name

Constructor Details

#initialize(yard_registry) ⇒ Registry

Returns a new instance of Registry.



126
127
128
# File 'lib/yattho/yard/registry.rb', line 126

def initialize(yard_registry)
  @yard_registry = yard_registry
end

Instance Attribute Details

#yard_registryObject (readonly)

Returns the value of attribute yard_registry.



124
125
126
# File 'lib/yattho/yard/registry.rb', line 124

def yard_registry
  @yard_registry
end

Class Method Details

.makeObject



116
117
118
119
120
121
# File 'lib/yattho/yard/registry.rb', line 116

def make
  registry = ::YARD::RegistryStore.new
  registry.load!(".yardoc")

  new(registry)
end

Instance Method Details

#find(component) ⇒ Object



130
131
132
133
134
135
136
# File 'lib/yattho/yard/registry.rb', line 130

def find(component)
  return entries[component] if entries.include?(component)

  return unless (docs = yard_registry.get(component.name))

  entries[component] = RegistryEntry.new(component, docs)
end