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.

Module for storing and managing specification documents.

This module acts as a registry for specification classes and handles the extraction of test specifications from context objects.

Class Method Summary collapse

Class Method Details

.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 test specifications from a list of context classes. Each specification consists of an environment and its associated test data.

Parameters:

  • contexts (Array<Fix::Dsl>)

    List of context classes to process

Returns:

  • (Array<Array>)

    Array of arrays where each sub-array contains:

    • 0

      environment: The test environment instance

    • 1

      location: The test file location (as “path:line”)

    • 2

      requirement: The test requirement (MUST, SHOULD, or MAY)

    • 3

      challenges: Array of test challenges to execute



31
32
33
34
35
# File 'lib/fix/doc.rb', line 31

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 contexts array for a named specification.

Parameters:

  • name (String, Symbol)

    The constant name of the specification

Returns:

  • (Array<Fix::Dsl>)

    Array of context classes for the specification

Raises:

  • (NameError)

    If specification constant is not found



18
19
20
# File 'lib/fix/doc.rb', line 18

def self.fetch(name)
  const_get("#{name}::CONTEXTS")
end

.spec_set(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.

Parameters:

  • name (String, Symbol)

    Name to register the specification under

  • klass (Class)

    The specification class to register

Raises:



43
44
45
46
47
# File 'lib/fix/doc.rb', line 43

def self.spec_set(name, klass)
  const_set(name, klass)
rescue ::NameError => _e
  raise Error::InvalidSpecificationName, name
end