Class: PublishingPlatformPublishingComponents::ComponentDocs

Inherits:
Object
  • Object
show all
Defined in:
app/models/publishing_platform_publishing_components/component_docs.rb

Instance Method Summary collapse

Constructor Details

#initialize(gem_components: false) ⇒ ComponentDocs

Returns a new instance of ComponentDocs.



4
5
6
# File 'app/models/publishing_platform_publishing_components/component_docs.rb', line 4

def initialize(gem_components: false)
  @documentation_directory = gem_components ? gem_documentation_directory : app_documentation_directory
end

Instance Method Details

#allObject



13
14
15
# File 'app/models/publishing_platform_publishing_components/component_docs.rb', line 13

def all
  fetch_component_docs.map { |component| build(component) }.sort_by(&:name)
end

#get(id) ⇒ Object



8
9
10
11
# File 'app/models/publishing_platform_publishing_components/component_docs.rb', line 8

def get(id)
  component = fetch_component_doc(id)
  build(component)
end

#used_in_this_appObject



17
18
19
# File 'app/models/publishing_platform_publishing_components/component_docs.rb', line 17

def used_in_this_app
  fetch_component_docs.map { |component| build(component) if component_in_use(component[:id]) }.compact.sort_by(&:name)
end