Module: Pre::Validators::Domain
- Included in:
- Pre::Validator
- Defined in:
- lib/pre/validators/domain.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.expiry ⇒ Object
6 7 8 |
# File 'lib/pre/validators/domain.rb', line 6 def self.expiry 3600 end |
Instance Method Details
#cache_key(key) ⇒ Object
10 11 12 |
# File 'lib/pre/validators/domain.rb', line 10 def cache_key key "resolv_dns_result_#{key}" end |
#valid_domain?(resolution_provider = Resolv::DNS.new) ⇒ Boolean
14 15 16 17 18 |
# File 'lib/pre/validators/domain.rb', line 14 def valid_domain?(resolution_provider = Resolv::DNS.new) cache_fetch cache_key(domain) do resolution_provider.getresources(domain, Resolv::DNS::Resource::IN::MX).any? end end |