Class: ContextSpook::Generator
- Inherits:
-
Object
- Object
- ContextSpook::Generator
- Includes:
- OutputContext, VerbosePuts
- Defined in:
- lib/context_spook/generator.rb
Overview
The Generator class provides a DSL parser that interprets context definition files and constructs structured context objects containing project metadata, file contents, command outputs, and variables for AI assistance.
Defined Under Namespace
Classes: Context
Instance Attribute Summary collapse
-
#verbose ⇒ Object
readonly
Returns the value of attribute verbose.
Instance Method Summary collapse
-
#context(&block) ⇒ Context
The context method creates or returns a context object.
-
#initialize(verbose: false, format: nil, &block) ⇒ Generator
constructor
The initialize method sets up the object by evaluating the provided block in the object’s context.
Methods included from OutputContext
#output_context, #output_context_size
Methods included from VerbosePuts
Constructor Details
#initialize(verbose: false, format: nil, &block) ⇒ Generator
The initialize method sets up the object by evaluating the provided block in the object’s context.
70 71 72 73 74 |
# File 'lib/context_spook/generator.rb', line 70 def initialize(verbose: false, format: nil, &block) @verbose = !!verbose @format = (format || 'JSON').upcase block and instance_eval(&block) end |
Instance Attribute Details
#verbose ⇒ Object (readonly)
Returns the value of attribute verbose.
59 60 61 |
# File 'lib/context_spook/generator.rb', line 59 def verbose @verbose end |
Instance Method Details
#context(&block) ⇒ Context
The context method creates or returns a context object.
81 82 83 84 85 86 87 88 |
# File 'lib/context_spook/generator.rb', line 81 def context(&block) if block @context and raise ArgumentError, "only one context allowed" @context = Context.new(generator: self, &block) else @context end end |