Created
February 4, 2018 20:29
-
-
Save ShimShtein/8b18e5894f563944567d235edfdbdf87 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class InterfaceCleaner | |
include ActiveRecord::Sanitization | |
ESCAPE_CHAR = '\\' | |
def self.nic_pattern_to_like(nic) | |
sanitize_sql_like(nic, ESCAPE_CHAR).tr('*', '%') | |
end | |
def self.ignored_interface_like_patterns | |
Setting[:ignored_interface_identifiers].map { |pattern| nic_pattern_to_like(pattern) } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment