Module: ContextSpook

Includes:
DSLKit::Interpreter
Defined in:
lib/context_spook/generator.rb,
lib/context_spook.rb,
lib/context_spook/version.rb

Overview

The ContextSpook module serves as a namespace container for collecting and organizing project information for AI assistance.

Defined Under Namespace

Classes: Generator

Constant Summary collapse

VERSION =

ContextSpook version

'0.2.0'
VERSION_ARRAY =

:nodoc:

VERSION.split('.').map(&:to_i)
VERSION_MAJOR =

:nodoc:

VERSION_ARRAY[0]
VERSION_MINOR =

:nodoc:

VERSION_ARRAY[1]
VERSION_BUILD =

:nodoc:

VERSION_ARRAY[2]

Class Method Summary collapse

Class Method Details

.generate_context(filename = nil, &block) ⇒ ContextSpook::Generator::Context

The generate_context method processes a context definition file and returns the resulting context object.

This method reads the content of a specified file, parses it using the generator’s parsing mechanism, and extracts the configured context from the parsed result.

from the file contents



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/context_spook/generator.rb', line 22

def self.generate_context(filename = nil, &block)
  filename.present? ^ block or
    raise ArgumentError, 'need either a filename or a &block argument'
  generator = if filename
              Generator.send(:new).send(:parse, File.read(filename))
              else
                Generator.send(:new, &block)
              end
  generator.output_context_size
  generator.context
end