Class: IpBlocklist
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- IpBlocklist
- Defined in:
- lib/generators/ruby_cms/templates/models/ip_blocklist.rb
Class Method Summary collapse
Class Method Details
.blocked?(ip_address) ⇒ Boolean
12 13 14 15 |
# File 'lib/generators/ruby_cms/templates/models/ip_blocklist.rb', line 12 def self.blocked?(ip_address) normalized = normalize_ip_address(ip_address) normalized.present? && where(ip_address: normalized).exists? end |
.normalize_ip_address(ip) ⇒ Object
23 24 25 26 27 |
# File 'lib/generators/ruby_cms/templates/models/ip_blocklist.rb', line 23 def self.normalize_ip_address(ip) return nil if ip.blank? ip.to_s.strip end |