Module: VkMusic::Utility::ArtistUrlParser

Defined in:
lib/vk_music/utility/artist_url_parser.rb

Overview

Artist URL parser

Constant Summary collapse

ARTIST_POSTFIX =

Regex for artist URL

%r{.*artist/([\w.\-~]+)}.freeze

Class Method Summary collapse

Class Method Details

.call(url) ⇒ String?

Parameters:

  • url (String)

Returns:

  • (String?)


15
16
17
18
19
# File 'lib/vk_music/utility/artist_url_parser.rb', line 15

def self.call(url)
  url.match(ARTIST_POSTFIX)&.captures&.first
rescue StandardError
  nil
end