Class: BitterDomain::DomainChecker
- Inherits:
-
Object
- Object
- BitterDomain::DomainChecker
- Defined in:
- lib/bitter_domain/domain_checker.rb
Instance Attribute Summary collapse
-
#available ⇒ Object
readonly
Returns the value of attribute available.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#tested ⇒ Object
readonly
Returns the value of attribute tested.
Instance Method Summary collapse
-
#initialize(domains) ⇒ DomainChecker
constructor
A new instance of DomainChecker.
- #print_available ⇒ Object
- #print_verbose ⇒ Object
- #retry ⇒ Object
- #test_domains ⇒ Object
Constructor Details
#initialize(domains) ⇒ DomainChecker
Returns a new instance of DomainChecker.
8 9 10 11 12 13 14 15 |
# File 'lib/bitter_domain/domain_checker.rb', line 8 def initialize(domains) @domains = domains @available = [] @errors = [] @tested = [] @whois = Whois::Client.new @error_msgs = [] end |
Instance Attribute Details
#available ⇒ Object (readonly)
Returns the value of attribute available.
7 8 9 |
# File 'lib/bitter_domain/domain_checker.rb', line 7 def available @available end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
7 8 9 |
# File 'lib/bitter_domain/domain_checker.rb', line 7 def errors @errors end |
#tested ⇒ Object (readonly)
Returns the value of attribute tested.
7 8 9 |
# File 'lib/bitter_domain/domain_checker.rb', line 7 def tested @tested end |
Instance Method Details
#print_available ⇒ Object
41 42 43 44 |
# File 'lib/bitter_domain/domain_checker.rb', line 41 def print_available @available.each { |domain| puts domain } puts "No available domains" if @available.empty? end |
#print_verbose ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/bitter_domain/domain_checker.rb', line 17 def print_verbose puts "\n\nHere are all the tested domains\n".blue @tested.each { |domain| puts domain } if @errors.any? puts "\n\nHere are all of the domains that errored out\n".red @errors.each { |domain| puts domain } end if @error_msgs.any? puts "\n\nHere are the error messages\n".red @error_msgs.each { |msg| puts msg } end rejected = @tested - @available if rejected.any? puts "\n\nHere are the rejected domains".yellow rejected.each { |dom| puts dom } end puts "\n\nHere are the available domains\n".green print_available end |
#retry ⇒ Object
50 51 52 53 54 |
# File 'lib/bitter_domain/domain_checker.rb', line 50 def retry copies = @errors.dup @errors = [] query_domains(copies) end |
#test_domains ⇒ Object
46 47 48 |
# File 'lib/bitter_domain/domain_checker.rb', line 46 def test_domains query_domains(@domains) end |