Class: Ryodo::Domain
- Inherits:
-
Object
show all
- Defined in:
- lib/ryodo/domain.rb
Defined Under Namespace
Classes: DomainString
Instance Method Summary
collapse
Constructor Details
#initialize(domainStr) ⇒ Domain
Returns a new instance of Domain.
29
30
31
32
33
34
|
# File 'lib/ryodo/domain.rb', line 29
def initialize(domainStr)
fail TypeError, "Not a valid domain string!" unless domainStr.is_a?(String)
@domain_string = DomainString.new domainStr.downcase
parse_domain_string
retrieve_domain_parts
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
pass all missings to @domain_string (String class)
75
76
77
|
# File 'lib/ryodo/domain.rb', line 75
def method_missing(name, *args, &block)
@domain_string.send(name, *args, &block)
end
|
Instance Method Details
#domain ⇒ Object
Also known as:
registered_domain, regdomain
41
42
43
|
# File 'lib/ryodo/domain.rb', line 41
def domain
DomainString.new(@domain) if @domain
end
|
#fqdn ⇒ Object
57
58
59
|
# File 'lib/ryodo/domain.rb', line 57
def fqdn
DomainString.new("#{self}.")
end
|
#inspect ⇒ Object
70
71
72
|
# File 'lib/ryodo/domain.rb', line 70
def inspect
@domain_string.inspect
end
|
#second_level ⇒ Object
Also known as:
sld, registered_name
47
48
49
|
# File 'lib/ryodo/domain.rb', line 47
def second_level
DomainString.new(@secondary) if @secondary
end
|
#send(symbol, *args) ⇒ Object
explicit definition of class’ send
80
81
82
|
# File 'lib/ryodo/domain.rb', line 80
def send(symbol, *args)
__send__(symbol, *args)
end
|
#subdomain ⇒ Object
53
54
55
|
# File 'lib/ryodo/domain.rb', line 53
def subdomain
DomainString.new(@subdomain) if @subdomain
end
|
#suffix ⇒ Object
Also known as:
tld
36
37
38
|
# File 'lib/ryodo/domain.rb', line 36
def suffix
DomainString.new(@suffix) if @suffix
end
|
#to_s ⇒ Object
66
67
68
|
# File 'lib/ryodo/domain.rb', line 66
def to_s
@domain_string
end
|
#valid? ⇒ Boolean
Also known as:
is_valid?
61
62
63
|
# File 'lib/ryodo/domain.rb', line 61
def valid?
@suffix && @secondary && true
end
|