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:

  • audios (Array)

    list of audios in playlist

  • id (Integer, nil) (defaults to: nil)
  • owner_id (Integer, nil) (defaults to: nil)
  • access_hash (String, nil) (defaults to: nil)
  • title (String) (defaults to: '')
  • subtitle (String, nil) (defaults to: nil)
  • real_size (Integer, 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:

  • (String, nil)

    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:

  • (Array)

    audios array



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

def audios
  @audios
end

#idInteger? (readonly)

Returns playlist ID.

Returns:

  • (Integer, nil)

    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:

  • (Integer, nil)

    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:

  • (Integer, nil)

    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:

  • (String, nil)

    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:

  • (String)

    playlist title



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

def title
  @title
end