Class: DomainCheck::MultiCheck

Inherits:
Object
  • Object
show all
Defined in:
lib/domain_check/multi_check.rb

Constant Summary collapse

DEFAULT_TLDS =
%w(com net org biz info name)

Instance Method Summary collapse

Constructor Details

#initialize(prefixes: nil, suffixes: nil, tlds: nil) ⇒ MultiCheck

Returns a new instance of MultiCheck.



4
5
6
7
8
9
# File 'lib/domain_check/multi_check.rb', line 4

def initialize(prefixes: nil, suffixes: nil, tlds: nil)
  @prefixes = prefixes
  @suffixes = suffixes
  @tlds     = tlds || DEFAULT_TLDS
  @tlds.each { |tld| tld.sub!(/^\./, '') }
end

Instance Method Details

#checkObject



11
12
13
14
15
16
17
18
19
# File 'lib/domain_check/multi_check.rb', line 11

def check
  results = []
  domains.each do |domain|
    result = DomainCheck::SingleCheck.new(domain).check
    yield result if block_given?
    results << result
  end
  results
end