Module: Blouson::SensitiveQueryFilter

Defined in:
lib/blouson/sensitive_query_filter.rb

Defined Under Namespace

Modules: AbstractAdapterFilter, Mysql2Filter, StatementInvalidErrorFilter

Constant Summary collapse

QUOTED_WORD_REGEXP =
/
  (?: '.+?(?<!\\)'
    | ".+?(?<!\\)"
  )
/x

Class Method Summary collapse

Class Method Details

.contain_sensitive_query?(message) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/blouson/sensitive_query_filter.rb', line 9

def self.contain_sensitive_query?(message)
  Blouson::SENSITIVE_TABLE_REGEXP === message
end

.filter_sensitive_words(message) ⇒ Object



13
14
15
# File 'lib/blouson/sensitive_query_filter.rb', line 13

def self.filter_sensitive_words(message)
  message.gsub(QUOTED_WORD_REGEXP, "'#{Blouson::FILTERED}'")
end