url_compare 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/url_compare.rb +11 -0
  2. metadata +49 -0
@@ -0,0 +1,11 @@
1
+ class UrlCompare
2
+ def self.similar?(first_url, second_url)
3
+ strip_url(first_url) == strip_url(second_url)
4
+ end
5
+
6
+ private
7
+
8
+ def self.strip_url(url)
9
+ url.split('#')[0].sub('//www.', '//').chomp('/')
10
+ end
11
+ end
metadata ADDED
@@ -0,0 +1,49 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: url_compare
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Adam Sheehan
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-07-05 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: ! 'Attempts to identify URLs that are identical or similar by
15
+
16
+ using some rules to normalize the strings before comparing them.
17
+
18
+ '
19
+ email: a.t.sheehan@gmail.com
20
+ executables: []
21
+ extensions: []
22
+ extra_rdoc_files: []
23
+ files:
24
+ - lib/url_compare.rb
25
+ homepage: http://github.com/atsheehan/url_compare
26
+ licenses: []
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ none: false
33
+ requirements:
34
+ - - ! '>='
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ required_rubygems_version: !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ! '>='
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ requirements: []
44
+ rubyforge_project:
45
+ rubygems_version: 1.8.24
46
+ signing_key:
47
+ specification_version: 3
48
+ summary: Tests URL strings for similarity.
49
+ test_files: []