Class: Songle::SongURI::NumericSongURI

Inherits:
Object
  • Object
show all
Includes:
Songle::SongURI
Defined in:
lib/songle/song_uri/numeric_song_uri.rb

Constant Summary collapse

TYPE =
"numeric"
URI_REGEXP =
/^(|[\w.]+\/[\w.]+\/|\/\/[\w.]+\/[\w.]+\/|http(|s):\/\/[\w.]+\/[\w.]+\/)(\d+)$/

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

Methods included from Songle::SongURI

#endpoint, parse, #permalink

Constructor Details

#initialize(query_string, options) ⇒ NumericSongURI

Returns a new instance of NumericSongURI.



18
19
20
21
22
23
24
# File 'lib/songle/song_uri/numeric_song_uri.rb', line 18

def initialize query_string, options
  super(options)

  @source_host = nil
  @source_path = nil
  @source_id   = $3 if query_string =~ URI_REGEXP
end

Instance Method Details

#to_sObject



36
37
38
# File 'lib/songle/song_uri/numeric_song_uri.rb', line 36

def to_s
  return "#{ self.endpoint }#{ @source_id }"
end

#typeObject



29
30
31
# File 'lib/songle/song_uri/numeric_song_uri.rb', line 29

def type
  return TYPE
end