Class: YoutubeUrlParser::YoutubeShareUrl
- Inherits:
-
Object
- Object
- YoutubeUrlParser::YoutubeShareUrl
show all
- Includes:
- ActiveModel::Model
- Defined in:
- lib/youtube_url_parser.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Instance Attribute Details
#link ⇒ Object
Returns the value of attribute link.
10
11
12
|
# File 'lib/youtube_url_parser.rb', line 10
def link
@link
end
|
#uri ⇒ Object
Returns the value of attribute uri.
10
11
12
|
# File 'lib/youtube_url_parser.rb', line 10
def uri
@uri
end
|
Class Method Details
.share_link?(link) ⇒ Boolean
12
13
14
|
# File 'lib/youtube_url_parser.rb', line 12
def self.share_link?(link)
link.include?("/youtu.be")
end
|
Instance Method Details
#parse_link ⇒ Object
23
24
25
|
# File 'lib/youtube_url_parser.rb', line 23
def parse_link
self.uri = URI.parse(link)
end
|
#youtube_id ⇒ Object
16
17
18
19
20
21
|
# File 'lib/youtube_url_parser.rb', line 16
def youtube_id
parse_link
return nil unless valid_host?
uri.path.delete("/")
end
|