Class: VkMusic::Playlist

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Enumerable
Defined in:
lib/vk_music/playlist.rb

Overview

Class representing VK playlist

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(audios, id: nil, owner_id: nil, access_hash: nil, title: '', subtitle: nil, real_size: nil) ⇒ Playlist

Initialize new playlist

Parameters:

  • list of audios in playlist

  • (defaults to: nil)
  • (defaults to: nil)
  • (defaults to: nil)
  • (defaults to: '')
  • (defaults to: nil)
  • (defaults to: nil)


32
33
34
35
36
37
38
39
40
# File 'lib/vk_music/playlist.rb', line 32

def initialize(audios, id: nil, owner_id: nil, access_hash: nil, title: '', subtitle: nil, real_size: nil)
  @audios = audios.dup
  @id = id
  @owner_id = owner_id
  @access_hash = access_hash
  @title = title.to_s.strip
  @subtitle = subtitle
  @real_size = real_size
end

Instance Attribute Details

#access_hashString? (readonly)

Returns access hash which should be part of link for some playlists.

Returns:

  • access hash which should be part of link for some playlists



14
15
16
# File 'lib/vk_music/playlist.rb', line 14

def access_hash
  @access_hash
end

#audiosArray (readonly)

Returns audios array.

Returns:

  • audios array



22
23
24
# File 'lib/vk_music/playlist.rb', line 22

def audios
  @audios
end

#idInteger? (readonly)

Returns playlist ID.

Returns:

  • playlist ID



10
11
12
# File 'lib/vk_music/playlist.rb', line 10

def id
  @id
end

#owner_idInteger? (readonly)

Returns playlist owner ID.

Returns:

  • playlist owner ID



12
13
14
# File 'lib/vk_music/playlist.rb', line 12

def owner_id
  @owner_id
end

#real_sizeInteger? (readonly)

Returns real size of playlist or nil if unknown.

Returns:

  • real size of playlist or nil if unknown



20
21
22
# File 'lib/vk_music/playlist.rb', line 20

def real_size
  @real_size
end

#subtitleString? (readonly)

Returns playlist subtitle. May be empty.

Returns:

  • playlist subtitle. May be empty



18
19
20
# File 'lib/vk_music/playlist.rb', line 18

def subtitle
  @subtitle
end

#titleString (readonly)

Returns playlist title.

Returns:

  • playlist title



16
17
18
# File 'lib/vk_music/playlist.rb', line 16

def title
  @title
end