Module: Fix::Doc Private
- Defined in:
- lib/fix/doc.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
The Doc module serves as a central registry for storing and managing test specifications. It provides functionality for:
- Storing specification classes in a structured way
- Managing the lifecycle of specification documents
- Extracting test specifications from context objects
- Validating specification names
The module acts as a namespace for specifications, allowing them to be:
- Registered with unique names
- Retrieved by name when needed
- Protected from name collisions
- Organized in a hierarchical structure
Class Method Summary collapse
-
.add(name, klass) ⇒ void
private
Registers a new specification class under the given name in the registry.
-
.extract_specifications(*contexts) ⇒ Array<Array>
private
Extracts complete test specifications from a list of context classes.
-
.fetch(name) ⇒ Array<Fix::Dsl>
private
Retrieves the array of test contexts associated with a named specification.
Class Method Details
.add(name, klass) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Registers a new specification class under the given name in the registry. The name must be a valid Ruby constant name to ensure proper namespace organization.
95 96 97 98 99 |
# File 'lib/fix/doc.rb', line 95 def self.add(name, klass) const_set(name, klass) rescue ::NameError => _e raise Error::InvalidSpecificationName, name end |
.extract_specifications(*contexts) ⇒ Array<Array>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Extracts complete test specifications from a list of context classes. This method processes contexts to build a list of executable test specifications.
Each extracted specification contains:
- The test environment
- The source file location
- The requirement level (MUST, SHOULD, or MAY)
- The list of challenges to execute
70 71 72 73 74 |
# File 'lib/fix/doc.rb', line 70 def self.extract_specifications(*contexts) contexts.flat_map do |context| extract_context_specifications(context) end end |
.fetch(name) ⇒ Array<Fix::Dsl>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Retrieves the array of test contexts associated with a named specification. These contexts define the test environment and requirements for the specification.
42 43 44 |
# File 'lib/fix/doc.rb', line 42 def self.fetch(name) const_get("#{name}::CONTEXTS") end |