url_common 0.1.5 → 0.1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bf016ee73428bc8dc46afb13ddf8aa1e21840650e38ac0b6c03d91c69453afca
4
- data.tar.gz: '098c5fcaa13ee7bf0b390bfae0af56784ed25547d7b0946591c2619344f004ca'
3
+ metadata.gz: 44520f0e72a8b34a964de97eabcc77ac626ac87f63007bfaad080731a6386340
4
+ data.tar.gz: 94de6938e7bbe2c3fb26baca7e81ae6648a8c1262b343afa668e8e2254a0ecbd
5
5
  SHA512:
6
- metadata.gz: 780507307f3b1c6745cddba4eeb37cbad88a623c8b6f694a51798c0347d80db5fffbc2210ffafe0b272e270ecc48bf036c35c7071384a656bcf0b0ca30cdc791
7
- data.tar.gz: bd449bfe93ecdfe735c947c8d6caba91962493778cbfe899cc456a5f056db2102c3ff208084f3fbd3ce47b3383c4046d3a1c4a6c5a5504e6974a81e9b809d0cd
6
+ metadata.gz: c645869a19c945e76d0a5cf22178139f36931dacd603921d30a26396ed4fa2fb35b00dac1cd9d6fc01cf03b3dae3872c8f8a1e4f0efe67c27011cc015891790a
7
+ data.tar.gz: 3789757ff530f562f8e2f56d0501380bab8c043997c67e0579a65e3b1c42a9396571a2aa91f2168b810fb90d76fff227b1efdbbb624337d0247fc025fd0b8794
data/Gemfile.lock CHANGED
@@ -8,7 +8,7 @@ GIT
8
8
  PATH
9
9
  remote: .
10
10
  specs:
11
- url_common (0.1.5)
11
+ url_common (0.1.6.1)
12
12
  fuzzyurl (~> 0.9.0)
13
13
  mechanize (~> 2.6)
14
14
 
@@ -1,3 +1,3 @@
1
1
  module UrlCommon
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6.1"
3
3
  end
data/lib/url_common.rb CHANGED
@@ -56,6 +56,9 @@ module UrlCommon
56
56
  # return parts.host.gsub(/^www./,'')
57
57
  # end
58
58
 
59
+ #
60
+ # Designed to get just the domain without the WWW
61
+ #
59
62
  def self.get_base_domain(url)
60
63
  #debugger if url =~ /c06rh22whx1g/
61
64
  begin
@@ -68,10 +71,25 @@ module UrlCommon
68
71
  end
69
72
  end
70
73
 
74
+ # designed to get the root of the domain i.e. elias.slack.com => slack.com
75
+ def self.get_root_domain(url)
76
+ begin
77
+ url = url.gsub(/ /,'%20')
78
+ url_parts = URI.parse(url)
79
+ host_parts = url_parts.host.split('.')
80
+ rescue StandardError => e
81
+ fu = Fuzzyurl.from_string(url)
82
+ host_parts = fu.hostname.split('.')
83
+ end
84
+ return host_parts[0] if host_parts.size == 1
85
+ return "#{host_parts[host_parts.size - 2]}.#{host_parts.last}"
86
+ end
87
+
71
88
  def self.join(base, rest, debug = false)
72
89
  return URI.join(base, rest).to_s
73
90
  end
74
91
 
92
+ # UrlCommon.url_no_www("https://www.youtube.com/watch?v=4Mj_zDw21xY")
75
93
  def self.url_no_www(url)
76
94
  parts = Fuzzyurl.new(url)
77
95
  if parts.query
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: url_common
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Johnson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-07-10 00:00:00.000000000 Z
11
+ date: 2022-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fuzzyurl