Class: SensitiveDataFilter::Middleware::Occurrence
- Inherits:
-
Object
- Object
- SensitiveDataFilter::Middleware::Occurrence
- Extended by:
- Forwardable
- Defined in:
- lib/sensitive_data_filter/middleware/occurrence.rb
Instance Attribute Summary collapse
-
#matches ⇒ Object
readonly
Returns the value of attribute matches.
Instance Method Summary collapse
- #filtered_body_params ⇒ Object
- #filtered_query_params ⇒ Object
-
#initialize(original_env_parser, filtered_env_parser, matches) ⇒ Occurrence
constructor
A new instance of Occurrence.
- #matches_count ⇒ Object
- #origin_ip ⇒ Object
- #original_body_params ⇒ Object
- #original_query_params ⇒ Object
- #to_h ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(original_env_parser, filtered_env_parser, matches) ⇒ Occurrence
12 13 14 15 16 |
# File 'lib/sensitive_data_filter/middleware/occurrence.rb', line 12 def initialize(original_env_parser, filtered_env_parser, matches) @original_env_parser = original_env_parser @filtered_env_parser = filtered_env_parser @matches = matches end |
Instance Attribute Details
#matches ⇒ Object (readonly)
Returns the value of attribute matches.
10 11 12 |
# File 'lib/sensitive_data_filter/middleware/occurrence.rb', line 10 def matches @matches end |
Instance Method Details
#filtered_body_params ⇒ Object
34 35 36 |
# File 'lib/sensitive_data_filter/middleware/occurrence.rb', line 34 def filtered_body_params @filtered_env_parser.body_params end |
#filtered_query_params ⇒ Object
30 31 32 |
# File 'lib/sensitive_data_filter/middleware/occurrence.rb', line 30 def filtered_query_params @filtered_env_parser.query_params end |
#matches_count ⇒ Object
40 41 42 |
# File 'lib/sensitive_data_filter/middleware/occurrence.rb', line 40 def matches_count @matches.map { |type, matches| [type, matches.count] }.to_h end |
#origin_ip ⇒ Object
18 19 20 |
# File 'lib/sensitive_data_filter/middleware/occurrence.rb', line 18 def origin_ip @original_env_parser.ip end |
#original_body_params ⇒ Object
26 27 28 |
# File 'lib/sensitive_data_filter/middleware/occurrence.rb', line 26 def original_body_params @original_env_parser.body_params end |
#original_query_params ⇒ Object
22 23 24 |
# File 'lib/sensitive_data_filter/middleware/occurrence.rb', line 22 def original_query_params @original_env_parser.query_params end |
#to_h ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/sensitive_data_filter/middleware/occurrence.rb', line 44 def to_h { origin_ip: origin_ip, request_method: request_method, url: url, content_type: content_type, filtered_query_params: filtered_query_params, filtered_body_params: filtered_body_params, session: session, matches_count: matches_count } end |
#to_s ⇒ Object
57 58 59 60 |
# File 'lib/sensitive_data_filter/middleware/occurrence.rb', line 57 def to_s "[SensitiveDataFilter] Sensitive Data detected and masked:\n" + to_h.map { |attribute, value| "#{attribute.to_s.titlecase}: #{value}" }.join("\n") end |