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
Modules: VerbosePuts Classes: Generator
Constant Summary collapse
- VERSION =
ContextSpook version
'0.7.2'- 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
-
.generate_context(filename = nil, verbose: false, &block) ⇒ ContextSpook::Generator::Context
The generate_context method processes a context definition file or block and returns the resulting context object.
Class Method Details
.generate_context(filename = nil, verbose: false, &block) ⇒ ContextSpook::Generator::Context
The generate_context method processes a context definition file or block and returns the resulting context object.
This method serves as the primary entry point for generating project context data. It accepts either a filename pointing to a context definition file or a block containing the context definition, but not both. When a filename is provided, it reads and parses the file content. When a block is provided, it evaluates the block within the generator’s context. The method ensures that only one context definition mechanism is used.
59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/context_spook/generator.rb', line 59 def self.generate_context(filename = nil, verbose: false, &block) verbose = !!verbose filename.present? ^ block or raise ArgumentError, 'need either a filename or a &block argument' generator = if filename Generator.send(:new, verbose:).send(:parse, File.read(filename)) else Generator.send(:new, verbose:, &block) end generator.output_context_size generator.context end |