Module: DomainCheck

Extended by:
DomainCheck
Included in:
DomainCheck
Defined in:
lib/domain_check.rb,
lib/domain_check/version.rb

Defined Under Namespace

Classes: ConsoleFormatter, MultiCheck, SingleCheck

Constant Summary collapse

VERSION =
"0.0.1"

Instance Method Summary collapse

Instance Method Details

#new(domain: nil, file: nil, prefixes: nil, suffixes: nil, tlds: nil) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/domain_check.rb', line 11

def new(domain: nil, file: nil, prefixes: nil, suffixes: nil, tlds: nil)
  if domain
    SingleCheck.new(domain)
  elsif file
    config = parse_file(file)
    MultiCheck.new(prefixes: config['prefixes'], suffixes: config['suffixes'], tlds: config['tlds'])
  elsif prefixes && suffixes
    MultiCheck.new(prefixes: prefixes, suffixes: suffixes, tlds: tlds)
  elsif prefixes || suffixes || tlds
    raise ArgumentError, "Must supply prefixes, suffixes, and TLDs"
  else
    raise ArgumentError, "No arguments given"
  end
end