Class: BitterDomain::DomainMapper
- Inherits:
-
Object
- Object
- BitterDomain::DomainMapper
- Defined in:
- lib/bitter_domain/domain_mapper.rb
Instance Attribute Summary collapse
-
#domain ⇒ Object
Returns the value of attribute domain.
-
#shifted_domains ⇒ Object
readonly
Returns the value of attribute shifted_domains.
Instance Method Summary collapse
- #check_domains(attempt_retry = false) ⇒ Object
- #gen_shifts ⇒ Object
- #get_available ⇒ Object
- #get_errors ⇒ Object
- #get_tested ⇒ Object
-
#initialize(domain) ⇒ DomainMapper
constructor
A new instance of DomainMapper.
- #print_available ⇒ Object
- #print_shifts ⇒ Object
- #print_verbose ⇒ Object
- #query_shifts ⇒ Object
- #retry ⇒ Object
Constructor Details
#initialize(domain) ⇒ DomainMapper
Returns a new instance of DomainMapper.
9 10 11 12 13 |
# File 'lib/bitter_domain/domain_mapper.rb', line 9 def initialize(domain) @domain = parse_domain(domain) @checker = nil @shifted_domains = [] end |
Instance Attribute Details
#domain ⇒ Object
Returns the value of attribute domain.
7 8 9 |
# File 'lib/bitter_domain/domain_mapper.rb', line 7 def domain @domain end |
#shifted_domains ⇒ Object (readonly)
Returns the value of attribute shifted_domains.
6 7 8 |
# File 'lib/bitter_domain/domain_mapper.rb', line 6 def shifted_domains @shifted_domains end |
Instance Method Details
#check_domains(attempt_retry = false) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/bitter_domain/domain_mapper.rb', line 32 def check_domains(attempt_retry=false) self.checker = BitterDomain::DomainChecker.new(@shifted_domains) self.checker.test_domains self.checker.retry if attempt_retry self.checker.available end |
#gen_shifts ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/bitter_domain/domain_mapper.rb', line 15 def gen_shifts host = @domain.sld shifter = BitterDomain::BitShifter.new(host) self.checker = nil @shifted_domains = shifter.get_shifted_domains .map { |dom| "#{dom}.#{@domain.tld}" } end |
#get_available ⇒ Object
41 42 43 |
# File 'lib/bitter_domain/domain_mapper.rb', line 41 def get_available self.checker.available end |
#get_errors ⇒ Object
45 46 47 |
# File 'lib/bitter_domain/domain_mapper.rb', line 45 def get_errors self.checker.errors end |
#get_tested ⇒ Object
49 50 51 |
# File 'lib/bitter_domain/domain_mapper.rb', line 49 def get_tested self.checker.tested end |
#print_available ⇒ Object
61 62 63 64 |
# File 'lib/bitter_domain/domain_mapper.rb', line 61 def print_available puts "Here are the available shifted domains" self.checker.print_available end |
#print_shifts ⇒ Object
23 24 25 |
# File 'lib/bitter_domain/domain_mapper.rb', line 23 def print_shifts self.shifted_domains.each { |shift| $stdout.puts "#{shift}" } end |
#print_verbose ⇒ Object
57 58 59 |
# File 'lib/bitter_domain/domain_mapper.rb', line 57 def print_verbose self.checker.print_verbose end |
#query_shifts ⇒ Object
66 67 68 69 70 71 |
# File 'lib/bitter_domain/domain_mapper.rb', line 66 def query_shifts gen_shifts check_domains get_available end |
#retry ⇒ Object
53 54 55 |
# File 'lib/bitter_domain/domain_mapper.rb', line 53 def retry self.checker.retry end |