Class: Ariadne::Yard::LookbookPagesBackend

Inherits:
Backend
  • Object
show all
Defined in:
lib/ariadne/yard/lookbook_pages_backend.rb

Overview

Backend that generates Lookbook pages.

Instance Attribute 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

Constructor Details

#initialize(registry, manifest) ⇒ LookbookPagesBackend

Returns a new instance of LookbookPagesBackend.



173
174
175
176
# File 'lib/ariadne/yard/lookbook_pages_backend.rb', line 173

def initialize(registry, manifest)
  @registry = registry
  @manifest = manifest
end

Instance Attribute Details

#manifestObject (readonly)

Returns the value of attribute manifest.



171
172
173
# File 'lib/ariadne/yard/lookbook_pages_backend.rb', line 171

def manifest
  @manifest
end

#registryObject (readonly)

Returns the value of attribute registry.



171
172
173
# File 'lib/ariadne/yard/lookbook_pages_backend.rb', line 171

def registry
  @registry
end

Instance Method Details

#generateObject



178
179
180
181
182
183
# File 'lib/ariadne/yard/lookbook_pages_backend.rb', line 178

def generate
  each_component do |component_ref|
    page_for(component_ref).generate
  end
  generate_system_args_docs
end

#page_for(component_ref) ⇒ Object



185
186
187
188
# File 'lib/ariadne/yard/lookbook_pages_backend.rb', line 185

def page_for(component_ref)
  docs = registry.find(component_ref.klass)
  LookbookPage.new(component_ref, self, docs)
end

#view_contextObject



190
191
192
193
194
# File 'lib/ariadne/yard/lookbook_pages_backend.rb', line 190

def view_context
  @view_context ||= super.tap do |vc|
    vc.singleton_class.include(LookbookDocsHelper)
  end
end