Class: VkMusic::WebParser::PlaylistSection
- Inherits:
-
Base
- Object
- Base
- VkMusic::WebParser::PlaylistSection
show all
- Defined in:
- lib/vk_music/web_parser/playlist_section.rb
Overview
PlaylistSection JSON parser
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#audios ⇒ Array<Audio>
13
14
15
16
17
18
19
|
# File 'lib/vk_music/web_parser/playlist_section.rb', line 13
def audios
return unless data&.key?('list')
data['list'].map do |el|
Utility::AudioDataParser.call(el, @client_id)
end
end
|
#data ⇒ Object
8
9
10
|
# File 'lib/vk_music/web_parser/playlist_section.rb', line 8
def data
@data ||= json['data'].first || {}
end
|
#more? ⇒ Boolean
46
47
48
49
50
|
# File 'lib/vk_music/web_parser/playlist_section.rb', line 46
def more?
return unless data&.key?('hasMore')
data['hasMore'].to_s == '1'
end
|
#real_size ⇒ Integer?
39
40
41
42
43
|
# File 'lib/vk_music/web_parser/playlist_section.rb', line 39
def real_size
return unless data&.key?('totalCount')
data['totalCount']
end
|
#subtitle ⇒ String?
29
30
31
32
33
34
35
36
|
# File 'lib/vk_music/web_parser/playlist_section.rb', line 29
def subtitle
return unless data&.key?('rawDescription')
re = data['rawDescription']
return if re.nil? || re.empty?
re
end
|
#title ⇒ String
22
23
24
25
26
|
# File 'lib/vk_music/web_parser/playlist_section.rb', line 22
def title
return unless data&.key?('title')
data['title'].to_s
end
|