module VkMusic::Utility::PostUrlParser

Load wall audios

Constants

POST_POSTFIX

Regex for post URL

Public Class Methods

call(url) click to toggle source

@param url [String] @return [Array(owner_id?, post_id?)]

# File lib/vk_music/utility/post_url_parser.rb, line 13
def self.call(url)
  matches = url.match(POST_POSTFIX)&.captures
  return [nil, nil] unless matches && matches.size == 2

  owner_id = Integer(matches[0], 10)
  post_id = Integer(matches[1], 10)

  [owner_id, post_id]
end