Class: PromptScrub::Configuration
- Inherits:
-
Object
- Object
- PromptScrub::Configuration
- Defined in:
- lib/promptscrub/configuration.rb
Instance Attribute Summary collapse
-
#detectors ⇒ Object
readonly
Returns the value of attribute detectors.
-
#scrub_request ⇒ Object
Returns the value of attribute scrub_request.
-
#scrub_response ⇒ Object
Returns the value of attribute scrub_response.
Instance Method Summary collapse
- #add_detector(type_or_detector, pattern = nil) ⇒ Object
- #disable_detector(type) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
8 9 10 11 12 |
# File 'lib/promptscrub/configuration.rb', line 8 def initialize @scrub_request = true @scrub_response = true @detectors = default_detectors end |
Instance Attribute Details
#detectors ⇒ Object (readonly)
Returns the value of attribute detectors.
6 7 8 |
# File 'lib/promptscrub/configuration.rb', line 6 def detectors @detectors end |
#scrub_request ⇒ Object
Returns the value of attribute scrub_request.
5 6 7 |
# File 'lib/promptscrub/configuration.rb', line 5 def scrub_request @scrub_request end |
#scrub_response ⇒ Object
Returns the value of attribute scrub_response.
5 6 7 |
# File 'lib/promptscrub/configuration.rb', line 5 def scrub_response @scrub_response end |
Instance Method Details
#add_detector(type_or_detector, pattern = nil) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/promptscrub/configuration.rb', line 14 def add_detector(type_or_detector, pattern = nil) detector = if type_or_detector.is_a?(Detector) type_or_detector else Detector.new(type_or_detector, pattern) end @detectors << detector self end |
#disable_detector(type) ⇒ Object
24 25 26 27 |
# File 'lib/promptscrub/configuration.rb', line 24 def disable_detector(type) @detectors.reject! { |d| d.type.casecmp(type.to_s).zero? } self end |