class VkMusic::WebParser::Base

Base class for all web parsers

Attributes

content[R]

Public Class Methods

new(content, client_id: nil) click to toggle source

@param content [String, Nokogiri::XML::Searchable] @param client_id [Integer?]

# File lib/vk_music/web_parser/base.rb, line 9
def initialize(content, client_id: nil)
  @content = content
  @client_id = client_id
end

Private Instance Methods

json() click to toggle source
# File lib/vk_music/web_parser/base.rb, line 22
def json
  @json ||= JSON.parse(@content.is_a?(String) ? @content : @content.body)
end
node() click to toggle source
# File lib/vk_music/web_parser/base.rb, line 18
def node
  @node ||= @content.is_a?(String) ? Nokogiri::HTML.fragment(@content) : @content
end