Class: Mixtape::RandomSongs
- Inherits:
-
Object
- Object
- Mixtape::RandomSongs
- Defined in:
- lib/mixtape/random_songs.rb
Instance Method Summary collapse
-
#initialize(sliced_songs) ⇒ RandomSongs
constructor
A new instance of RandomSongs.
- #pick_by(number_per_section) ⇒ Object
Constructor Details
#initialize(sliced_songs) ⇒ RandomSongs
Returns a new instance of RandomSongs.
3 4 5 |
# File 'lib/mixtape/random_songs.rb', line 3 def initialize(sliced_songs) @sliced_songs = sliced_songs end |
Instance Method Details
#pick_by(number_per_section) ⇒ Object
7 8 9 10 11 |
# File 'lib/mixtape/random_songs.rb', line 7 def pick_by(number_per_section) @sliced_songs.map do |slice| slice.sample(number_per_section) end.flatten end |