Module: Addressabler::URI
- Defined in:
- lib/addressabler/uri.rb
Instance Method Summary collapse
- #domain ⇒ Object
- #domain=(new_domain) ⇒ Object
- #query_hash ⇒ Object
- #query_hash=(new_query_hash) ⇒ Object
- #subdomain ⇒ Object
- #subdomain=(new_subdomain) ⇒ Object
- #tld ⇒ Object
- #tld=(new_tld) ⇒ Object
Instance Method Details
#domain ⇒ Object
7 8 9 10 |
# File 'lib/addressabler/uri.rb', line 7 def domain return nil unless host parse_domain_parts[:domain] end |
#domain=(new_domain) ⇒ Object
12 13 14 |
# File 'lib/addressabler/uri.rb', line 12 def domain=(new_domain) self.host = "#{subdomain}.#{new_domain}.#{tld}" end |
#query_hash ⇒ Object
16 17 18 |
# File 'lib/addressabler/uri.rb', line 16 def query_hash @query_hash ||= query_hash_for(query_values || {}) end |
#query_hash=(new_query_hash) ⇒ Object
20 21 22 |
# File 'lib/addressabler/uri.rb', line 20 def query_hash=(new_query_hash) @query_hash = query_hash_for(new_query_hash || {}) end |
#subdomain ⇒ Object
24 25 26 27 |
# File 'lib/addressabler/uri.rb', line 24 def subdomain return nil unless host parse_domain_parts[:subdomain] end |
#subdomain=(new_subdomain) ⇒ Object
29 30 31 |
# File 'lib/addressabler/uri.rb', line 29 def subdomain=(new_subdomain) self.host = "#{new_subdomain}.#{domain}.#{tld}" end |
#tld ⇒ Object
33 34 35 36 |
# File 'lib/addressabler/uri.rb', line 33 def tld return nil unless host Addressabler.parse_tld(host) end |
#tld=(new_tld) ⇒ Object
38 39 40 |
# File 'lib/addressabler/uri.rb', line 38 def tld=(new_tld) self.host = "#{subdomain}.#{domain}.#{new_tld}" end |