Class: Songle::SongURI::YtSchemeSongURI
- Inherits:
-
Object
- Object
- Songle::SongURI::YtSchemeSongURI
- Includes:
- Songle::SongURI
- Defined in:
- lib/songle/song_uri/yt_scheme_song_uri.rb
Constant Summary collapse
- SOURCE_HOST =
::Songle::SongURI::YtSongURI::SOURCE_HOST
- SOURCE_PATH =
::Songle::SongURI::YtSongURI::SOURCE_PATH
- TYPE =
::Songle::SongURI::YtSongURI::TYPE
- URI_REGEXP =
/^yt:\/\/(.+)$/
Constants included from Songle::SongURI
ENDPOINT_HOST, ENDPOINT_PATH, ENDPOINT_SCHEME
Instance Attribute Summary
Attributes included from Songle::SongURI
#endpoint_host, #endpoint_path, #endpoint_scheme, #source_host, #source_id, #source_path
Instance Method Summary collapse
-
#initialize(query_string, options) ⇒ YtSchemeSongURI
constructor
A new instance of YtSchemeSongURI.
- #type ⇒ Object
Methods included from Songle::SongURI
#endpoint, parse, #permalink, #to_s
Constructor Details
#initialize(query_string, options) ⇒ YtSchemeSongURI
Returns a new instance of YtSchemeSongURI.
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/songle/song_uri/yt_scheme_song_uri.rb', line 28 def initialize query_string, super() @source_host = SOURCE_HOST @source_path = SOURCE_PATH @source_id = $1 if query_string =~ URI_REGEXP if @source_id.nil? || @source_id.strip.empty? raise ::Songle::SongURI::InvalidSongURIError.new(query_string) end @source_path += @source_id end |
Instance Method Details
#type ⇒ Object
45 46 47 |
# File 'lib/songle/song_uri/yt_scheme_song_uri.rb', line 45 def type return TYPE end |