Parent

Class/Module Index [+]

Quicksearch

Domainatrix::Url

Attributes

domain[R]
host[R]
path[R]
public_suffix[R]
scheme[R]
subdomain[R]
url[R]

Public Class Methods

new(attrs = {}) click to toggle source
# File lib/domainatrix/url.rb, line 5
def initialize(attrs = {})
  @scheme = attrs[:scheme]
  @host = attrs[:host]
  @url = attrs[:url]
  @public_suffix = attrs[:public_suffix]
  @domain = attrs[:domain]
  @subdomain = attrs[:subdomain]
  @path = attrs[:path]
end

Public Instance Methods

canonical(options = {}) click to toggle source
# File lib/domainatrix/url.rb, line 15
def canonical(options = {})
  public_suffix_parts = @public_suffix.split(".")
  url = "#{public_suffix_parts.reverse.join(".")}.#{@domain}"
  if @subdomain && !@subdomain.empty?
    subdomain_parts = @subdomain.split(".")
    url << ".#{subdomain_parts.reverse.join(".")}"
  end
  url << @path if @path

  url
end
domain_with_public_suffix() click to toggle source
# File lib/domainatrix/url.rb, line 27
def domain_with_public_suffix
  "#{@domain}.#{@public_suffix}"
end
Also aliased as: domain_with_tld
domain_with_tld() click to toggle source

[Validate]

Generated with the Darkfish Rdoc Generator 2.