Class: GovukPublishingComponents::ComponentDocs
- Inherits:
-
Object
- Object
- GovukPublishingComponents::ComponentDocs
- Defined in:
- app/models/govuk_publishing_components/component_docs.rb
Instance Method Summary collapse
- #all ⇒ Object
- #get(id) ⇒ Object
-
#initialize(gem_components: false, limit_to: false) ⇒ ComponentDocs
constructor
A new instance of ComponentDocs.
- #used_in_this_app ⇒ Object
Constructor Details
#initialize(gem_components: false, limit_to: false) ⇒ ComponentDocs
Returns a new instance of ComponentDocs.
4 5 6 7 |
# File 'app/models/govuk_publishing_components/component_docs.rb', line 4 def initialize(gem_components: false, limit_to: false) @limit_to = limit_to @documentation_directory = gem_components ? gem_documentation_directory : app_documentation_directory end |
Instance Method Details
#all ⇒ Object
14 15 16 |
# File 'app/models/govuk_publishing_components/component_docs.rb', line 14 def all fetch_component_docs.map { |component| build(component) }.sort_by(&:name) end |
#get(id) ⇒ Object
9 10 11 12 |
# File 'app/models/govuk_publishing_components/component_docs.rb', line 9 def get(id) component = fetch_component_doc(id) build(component) end |
#used_in_this_app ⇒ Object
18 19 20 |
# File 'app/models/govuk_publishing_components/component_docs.rb', line 18 def used_in_this_app fetch_component_docs.map { |component| build(component) if component_in_use(component[:id]) }.compact.sort_by(&:name) end |