Module: Ariadne::Static
- Defined in:
- lib/ariadne/static.rb,
lib/ariadne/static/generate_previews.rb,
lib/ariadne/static/generate_statuses.rb,
lib/ariadne/static/generate_arguments.rb,
lib/ariadne/static/generate_constants.rb,
lib/ariadne/static/generate_structure.rb,
lib/ariadne/static/generate_audited_at.rb
Overview
:nodoc:
Defined Under Namespace
Modules: GenerateArguments, GenerateAuditedAt, GenerateConstants, GeneratePreviews, GenerateStatuses, GenerateStructure
Constant Summary collapse
- DEFAULT_STATIC_PATH =
File.join("docs", "src", "_data", "ariadne_view_components").freeze
- FILE_NAMES =
{ constants: "constants.json", audited_at: "audited_at.json", arguments: "arguments.json", previews: "previews.json", structure: "structure.json", toc: "toc.json", }.freeze
Class Method Summary collapse
-
.dump(stats) ⇒ Object
Generates the requested stat hash and outputs it to a file.
-
.generate_arguments ⇒ Object
Returns an array of hashes, one per Ariadne component, that contains some metadata and a list of the arguments accepted by the component’s constructor.
-
.generate_audited_at ⇒ Object
Returns a hash mapping component names to the date on which the component passed an accessibility audit.
-
.generate_constants ⇒ Object
Returns a hash mapping component names to an array of the constants defined inside the component’s class.
-
.generate_previews ⇒ Object
Returns an array of hashes, one per Ariadne component, that contains some metadata and an array of all the component’s previews.
-
.generate_structure ⇒ Object
Returns an array of hashes, one per Ariadne component, that contains all the data needed for the new primer.style docsite.
-
.read(stats) ⇒ Object
Returns the contents of the stat file.
Class Method Details
.dump(stats) ⇒ Object
Generates the requested stat hash and outputs it to a file.
55 56 57 58 59 60 |
# File 'lib/ariadne/static.rb', line 55 def dump(stats) File.open(File.join(DEFAULT_STATIC_PATH, FILE_NAMES[stats]), "w") do |f| f.write(JSON.pretty_generate(send(:"generate_#{stats}"))) f.write($INPUT_RECORD_SEPARATOR) end end |
.generate_arguments ⇒ Object
Returns an array of hashes, one per Ariadne component, that contains some metadata and a list of the arguments accepted by the component’s constructor. Arguments are enumerated with their value, data type, and docstring.
37 38 39 |
# File 'lib/ariadne/static.rb', line 37 def generate_arguments Static::GenerateArguments.call end |
.generate_audited_at ⇒ Object
Returns a hash mapping component names to the date on which the component passed an accessibility audit.
30 31 32 |
# File 'lib/ariadne/static.rb', line 30 def generate_audited_at Static::GenerateAuditedAt.call end |
.generate_constants ⇒ Object
Returns a hash mapping component names to an array of the constants defined inside the component’s class.
24 25 26 |
# File 'lib/ariadne/static.rb', line 24 def generate_constants Static::GenerateConstants.call end |
.generate_previews ⇒ Object
Returns an array of hashes, one per Ariadne component, that contains some metadata and an array of all the component’s previews. The preview data contains the Lookbook URL to each preview and its name.
44 45 46 |
# File 'lib/ariadne/static.rb', line 44 def generate_previews Static::GeneratePreviews.call end |
.generate_structure ⇒ Object
Returns an array of hashes, one per Ariadne component, that contains all the data needed for the new primer.style docsite.
50 51 52 |
# File 'lib/ariadne/static.rb', line 50 def generate_structure Static::GenerateStructure.call end |
.read(stats) ⇒ Object
Returns the contents of the stat file.
63 64 65 |
# File 'lib/ariadne/static.rb', line 63 def read(stats) File.read(File.join(DEFAULT_STATIC_PATH, FILE_NAMES[stats])) end |