Class: Ariadne::Yard::Registry

Inherits:
Object
  • Object
show all
Extended by:
ViewHelper, DocsHelper, ViewComponent::TestHelpers
Defined in:
lib/ariadne/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_default_value, pretty_value, status_module_and_short_name

Methods included from ViewHelper

generate_id

Constructor Details

#initialize(yard_registry) ⇒ Registry

Returns a new instance of Registry.



116
117
118
# File 'lib/ariadne/yard/registry.rb', line 116

def initialize(yard_registry)
  @yard_registry = yard_registry
end

Instance Attribute Details

#yard_registryObject (readonly)

Returns the value of attribute yard_registry.



114
115
116
# File 'lib/ariadne/yard/registry.rb', line 114

def yard_registry
  @yard_registry
end

Class Method Details

.makeObject



106
107
108
109
110
111
# File 'lib/ariadne/yard/registry.rb', line 106

def make
  registry = ::YARD::RegistryStore.new
  registry.load!(File.expand_path(File.join("..", "..", "..", ".yardoc"), __dir__))

  new(registry)
end

Instance Method Details

#find(component) ⇒ Object



120
121
122
123
124
125
126
# File 'lib/ariadne/yard/registry.rb', line 120

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