Class: Promptmenot::Configuration
- Inherits:
-
Object
- Object
- Promptmenot::Configuration
- Defined in:
- lib/promptmenot/configuration.rb
Constant Summary collapse
- VALID_SENSITIVITIES =
%i[low medium high paranoid].freeze
- VALID_MODES =
%i[reject sanitize].freeze
Instance Attribute Summary collapse
-
#max_length ⇒ Object
Returns the value of attribute max_length.
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#on_detect ⇒ Object
Returns the value of attribute on_detect.
-
#replacement_text ⇒ Object
Returns the value of attribute replacement_text.
-
#sensitivity ⇒ Object
Returns the value of attribute sensitivity.
Instance Method Summary collapse
- #add_pattern(name:, regex:, category: :custom, sensitivity: :medium, confidence: :medium) ⇒ Object
- #custom_patterns ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
11 12 13 14 15 16 17 18 19 |
# File 'lib/promptmenot/configuration.rb', line 11 def initialize @sensitivity = :medium @mode = :reject @replacement_text = "[removed]" @max_length = 50_000 @custom_patterns_list = [] @custom_patterns = nil @on_detect = nil end |
Instance Attribute Details
#max_length ⇒ Object
Returns the value of attribute max_length.
9 10 11 |
# File 'lib/promptmenot/configuration.rb', line 9 def max_length @max_length end |
#mode ⇒ Object
Returns the value of attribute mode.
8 9 10 |
# File 'lib/promptmenot/configuration.rb', line 8 def mode @mode end |
#on_detect ⇒ Object
Returns the value of attribute on_detect.
9 10 11 |
# File 'lib/promptmenot/configuration.rb', line 9 def on_detect @on_detect end |
#replacement_text ⇒ Object
Returns the value of attribute replacement_text.
9 10 11 |
# File 'lib/promptmenot/configuration.rb', line 9 def replacement_text @replacement_text end |
#sensitivity ⇒ Object
Returns the value of attribute sensitivity.
8 9 10 |
# File 'lib/promptmenot/configuration.rb', line 8 def sensitivity @sensitivity end |
Instance Method Details
#add_pattern(name:, regex:, category: :custom, sensitivity: :medium, confidence: :medium) ⇒ Object
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/promptmenot/configuration.rb', line 43 def add_pattern(name:, regex:, category: :custom, sensitivity: :medium, confidence: :medium) @custom_patterns_list << Pattern.new( name: name, category: category, regex: regex, sensitivity: sensitivity, confidence: confidence ) @custom_patterns = nil end |
#custom_patterns ⇒ Object
39 40 41 |
# File 'lib/promptmenot/configuration.rb', line 39 def custom_patterns @custom_patterns ||= @custom_patterns_list.dup.freeze end |