youtube_url_parser 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/youtube_url_parser.rb +5 -3
  3. metadata +2 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5056a518d86f597b391cc3255c180f5cd878a71719b565daeefdbeec7336d2d0
4
- data.tar.gz: b92c49bf64a633f40c2d278a10d00101e4daba9bdf74516681e1889d909262c0
3
+ metadata.gz: eea133aa3e690ff5708d8303d3d4ad0d6ea24bf6e30513e5a64e1d8b44d018ea
4
+ data.tar.gz: af8f53950167a9d88463b039219903571770950ad19ccd1a8411919b5ab78f89
5
5
  SHA512:
6
- metadata.gz: 127ac1c2e736dab479a4f4f7a0e7112511d7d59cba683baf55a4df6318bc6aacf0bc1e2b6ec97a50edf95d831ea4609d45a889b2fc960bc88874f4a12ff3176b
7
- data.tar.gz: b84f3961b0c24ec4e9db8c0bd16eb905b25b53dd686afd9d6120a248760407eab3bfd4a3fc9fa11a517bab02b14dc0d67c81f8d6b35f34fa56c3ec3eb79b77ae
6
+ metadata.gz: 3368412ddaaa4c3da67900f5cf27cb151c7daab324b4f97443558d502536f40d834d4621d24a2944f8dd7214fa3cab1b8297b3e177874baef6469ca515b9982e
7
+ data.tar.gz: 69ee585bacc0b0adeac9b5c9112c7928a68ecf3a35ceef2ee6ab5258b732f1f68b30404c9d6b0862b0aba9660e3d9abc8a02efdaca3ef0af109a5eb923910ff1
@@ -1,18 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "uri"
4
- require "active_model"
5
4
  require "rack/utils"
6
5
 
7
6
  class YoutubeUrlParser
8
7
  class YoutubeShareUrl
9
- include ActiveModel::Model
10
8
  attr_accessor :link, :uri
11
9
 
12
10
  def self.share_link?(link)
13
11
  link.include?("/youtu.be")
14
12
  end
15
13
 
14
+ def initialize(link:)
15
+ @link = link
16
+ end
17
+
16
18
  def youtube_id
17
19
  parse_link
18
20
  return nil unless valid_host?
@@ -94,7 +96,7 @@ class YoutubeUrlParser
94
96
 
95
97
  youtube_link = define_link(link).new(:link => link)
96
98
 
97
- if youtube_link.youtube_id.present?
99
+ if youtube_link.youtube_id && !youtube_link.youtube_id.empty?
98
100
  return "https://www.youtube.com/watch?v=#{youtube_link.youtube_id}"
99
101
  end
100
102
 
metadata CHANGED
@@ -1,35 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: youtube_url_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ole Palm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-18 00:00:00.000000000 Z
11
+ date: 2023-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: activemodel
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '5.0'
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '8.0'
23
- type: :runtime
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: '5.0'
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '8.0'
33
13
  - !ruby/object:Gem::Dependency
34
14
  name: rack
35
15
  requirement: !ruby/object:Gem::Requirement