Class: Aidp::Harness::OutputFilterConfig
- Inherits:
-
Object
- Object
- Aidp::Harness::OutputFilterConfig
- Defined in:
- lib/aidp/harness/output_filter_config.rb
Overview
Value object for output filter configuration Provides validation and type-safe access to filtering options
Constant Summary collapse
- VALID_MODES =
%i[full failures_only minimal].freeze
- DEFAULT_MODE =
:full- DEFAULT_INCLUDE_CONTEXT =
true- DEFAULT_CONTEXT_LINES =
3- DEFAULT_MAX_LINES =
500- MIN_CONTEXT_LINES =
0- MAX_CONTEXT_LINES =
20- MIN_MAX_LINES =
10- MAX_MAX_LINES =
10_000
Instance Attribute Summary collapse
-
#context_lines ⇒ Object
readonly
Returns the value of attribute context_lines.
-
#include_context ⇒ Object
readonly
Returns the value of attribute include_context.
-
#max_lines ⇒ Object
readonly
Returns the value of attribute max_lines.
-
#mode ⇒ Object
readonly
Returns the value of attribute mode.
Class Method Summary collapse
-
.from_hash(hash) ⇒ OutputFilterConfig
Create from a hash (useful for configuration loading).
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
(also: #eql?)
Compare with another config.
-
#filtering_enabled? ⇒ Boolean
Check if filtering is enabled.
-
#hash ⇒ Object
Hash for use in Hash/Set.
-
#initialize(mode: DEFAULT_MODE, include_context: DEFAULT_INCLUDE_CONTEXT, context_lines: DEFAULT_CONTEXT_LINES, max_lines: DEFAULT_MAX_LINES) ⇒ OutputFilterConfig
constructor
Create a new OutputFilterConfig.
-
#to_h ⇒ Hash
Convert to hash (useful for serialization).
Constructor Details
#initialize(mode: DEFAULT_MODE, include_context: DEFAULT_INCLUDE_CONTEXT, context_lines: DEFAULT_CONTEXT_LINES, max_lines: DEFAULT_MAX_LINES) ⇒ OutputFilterConfig
Create a new OutputFilterConfig
26 27 28 29 30 31 32 33 34 |
# File 'lib/aidp/harness/output_filter_config.rb', line 26 def initialize(mode: DEFAULT_MODE, include_context: DEFAULT_INCLUDE_CONTEXT, context_lines: DEFAULT_CONTEXT_LINES, max_lines: DEFAULT_MAX_LINES) @mode = validate_mode(mode) @include_context = validate_boolean(include_context, "include_context") @context_lines = validate_context_lines(context_lines) @max_lines = validate_max_lines(max_lines) freeze end |
Instance Attribute Details
#context_lines ⇒ Object (readonly)
Returns the value of attribute context_lines.
18 19 20 |
# File 'lib/aidp/harness/output_filter_config.rb', line 18 def context_lines @context_lines end |
#include_context ⇒ Object (readonly)
Returns the value of attribute include_context.
18 19 20 |
# File 'lib/aidp/harness/output_filter_config.rb', line 18 def include_context @include_context end |
#max_lines ⇒ Object (readonly)
Returns the value of attribute max_lines.
18 19 20 |
# File 'lib/aidp/harness/output_filter_config.rb', line 18 def max_lines @max_lines end |
#mode ⇒ Object (readonly)
Returns the value of attribute mode.
18 19 20 |
# File 'lib/aidp/harness/output_filter_config.rb', line 18 def mode @mode end |
Class Method Details
.from_hash(hash) ⇒ OutputFilterConfig
Create from a hash (useful for configuration loading)
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/aidp/harness/output_filter_config.rb', line 39 def self.from_hash(hash) hash = hash.transform_keys(&:to_sym) if hash.respond_to?(:transform_keys) new( mode: hash[:mode] || DEFAULT_MODE, include_context: hash.fetch(:include_context, DEFAULT_INCLUDE_CONTEXT), context_lines: hash[:context_lines] || DEFAULT_CONTEXT_LINES, max_lines: hash[:max_lines] || DEFAULT_MAX_LINES ) end |
Instance Method Details
#==(other) ⇒ Boolean Also known as: eql?
Compare with another config
70 71 72 73 74 75 76 77 |
# File 'lib/aidp/harness/output_filter_config.rb', line 70 def ==(other) return false unless other.is_a?(OutputFilterConfig) @mode == other.mode && @include_context == other.include_context && @context_lines == other.context_lines && @max_lines == other.max_lines end |
#filtering_enabled? ⇒ Boolean
Check if filtering is enabled
63 64 65 |
# File 'lib/aidp/harness/output_filter_config.rb', line 63 def filtering_enabled? @mode != :full end |
#hash ⇒ Object
Hash for use in Hash/Set
81 82 83 |
# File 'lib/aidp/harness/output_filter_config.rb', line 81 def hash [@mode, @include_context, @context_lines, @max_lines].hash end |
#to_h ⇒ Hash
Convert to hash (useful for serialization)
52 53 54 55 56 57 58 59 |
# File 'lib/aidp/harness/output_filter_config.rb', line 52 def to_h { mode: @mode, include_context: @include_context, context_lines: @context_lines, max_lines: @max_lines } end |