Guest User

Untitled

a guest
Feb 17th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. class InterfaceCleaner
  2. include ActiveRecord::Sanitization
  3.  
  4. ESCAPE_CHAR = '\\'
  5.  
  6. def self.nic_pattern_to_like(nic)
  7. sanitize_sql_like(nic, ESCAPE_CHAR).tr('*', '%')
  8. end
  9.  
  10. def self.ignored_interface_like_patterns
  11. Setting[:ignored_interface_identifiers].map { |pattern| nic_pattern_to_like(pattern) }
  12. end
  13. end
Add Comment
Please, Sign In to add comment