domainatrix 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,5 +23,11 @@ module Domainatrix
23
23
 
24
24
  url
25
25
  end
26
+
27
+ def domain_with_public_suffix
28
+ "#{@domain}.#{@public_suffix}"
29
+ end
30
+ alias domain_with_tld domain_with_public_suffix
31
+
26
32
  end
27
33
  end
data/lib/domainatrix.rb CHANGED
@@ -5,7 +5,7 @@ require 'domainatrix/domain_parser.rb'
5
5
  require 'domainatrix/url.rb'
6
6
 
7
7
  module Domainatrix
8
- VERSION = "0.0.9"
8
+ VERSION = "0.0.10"
9
9
  DOMAIN_PARSER = DomainParser.new("#{File.dirname(__FILE__)}/effective_tld_names.dat")
10
10
 
11
11
  def self.parse(url)
@@ -38,4 +38,17 @@ describe "url" do
38
38
  it "canonicalizes the url without the path" do
39
39
  Domainatrix::Url.new(:subdomain => "foo", :domain => "pauldix", :public_suffix => "net").canonical(:include_path => false).should == "net.pauldix.foo"
40
40
  end
41
+
42
+ it "combines the domain with the public_suffix" do
43
+ Domainatrix::Url.new(:domain => "pauldix", :public_suffix => "net").domain_with_public_suffix.should == "pauldix.net"
44
+ Domainatrix::Url.new(:domain => "foo", :public_suffix => "co.uk" ).domain_with_public_suffix.should == "foo.co.uk"
45
+ Domainatrix::Url.new(:subdomain => "baz", :domain => "bar", :public_suffix => "com").domain_with_public_suffix.should == "bar.com"
46
+ end
47
+
48
+ it "combines the domain with the public_suffix as an alias" do
49
+ Domainatrix::Url.new(:domain => "pauldix", :public_suffix => "net").domain_with_tld.should == "pauldix.net"
50
+ Domainatrix::Url.new(:domain => "foo", :public_suffix => "co.uk" ).domain_with_tld.should == "foo.co.uk"
51
+ Domainatrix::Url.new(:subdomain => "baz", :domain => "bar", :public_suffix => "com").domain_with_tld.should == "bar.com"
52
+ end
53
+
41
54
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: domainatrix
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.9
5
+ version: 0.0.10
6
6
  platform: ruby
7
7
  authors:
8
8
  - Paul Dix