Module: Ace::Review::Molecules::SubjectStrategy
- Defined in:
- lib/ace/review/molecules/subject_strategy.rb
Overview
Factory and interface for subject splitting strategies
The SubjectStrategy module provides a factory method for creating strategies that determine how review subjects are split or processed before being sent to an LLM for review.
Available strategies:
-
:full - Pass-through strategy, no splitting (default)
-
:chunked - Split by logical boundaries (future)
-
:adaptive - Auto-select based on size (future)
Constant Summary collapse
- STRATEGIES =
Registry of available strategy classes
{ full: "Ace::Review::Molecules::Strategies::FullStrategy", chunked: "Ace::Review::Molecules::Strategies::ChunkedStrategy", adaptive: "Ace::Review::Molecules::Strategies::AdaptiveStrategy" }.freeze
Class Method Summary collapse
-
.available?(type) ⇒ Boolean
Check if a strategy type is available.
-
.available_strategies ⇒ Array<Symbol>
List available strategy types.
-
.for(type, config = {}) ⇒ Object
Factory method to create a strategy instance.
Class Method Details
.available?(type) ⇒ Boolean
Check if a strategy type is available
68 69 70 |
# File 'lib/ace/review/molecules/subject_strategy.rb', line 68 def self.available?(type) STRATEGIES.key?(type.to_sym) end |
.available_strategies ⇒ Array<Symbol>
List available strategy types
75 76 77 |
# File 'lib/ace/review/molecules/subject_strategy.rb', line 75 def self.available_strategies STRATEGIES.keys end |
.for(type, config = {}) ⇒ Object
Factory method to create a strategy instance
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/ace/review/molecules/subject_strategy.rb', line 46 def self.for(type, config = {}) type_sym = type.to_sym class_name = STRATEGIES[type_sym] unless class_name available = STRATEGIES.keys.join(", ") raise Ace::Review::Errors::UnknownStrategyError, "Unknown strategy type '#{type}'. Available strategies: #{available}" end # Lazy require the strategy class require_strategy(type_sym) # Get the class and instantiate klass = Object.const_get(class_name) klass.new(config) end |