Class: Notu::LovedTracks
- Inherits:
-
Object
show all
- Includes:
- Listing
- Defined in:
- lib/notu/loved_tracks.rb
Instance Attribute Summary
Attributes included from Listing
#library
Instance Method Summary
collapse
Methods included from Listing
#initialize, #page_urls, #pages_count, #params
Instance Method Details
#each(&block) ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/notu/loved_tracks.rb', line 7
def each(&block)
return unless block_given?
page_urls.each do |url|
document = HtmlDocument.get(url)
(document/'#user-loved-tracks-section tbody tr').each do |element|
artist = (element/'td.chartlist-name .chartlist-artists').first.try(:text) || next
title = (element/'td.chartlist-name .link-block-target').first.try(:text) || next
yield(Track.new(artist: artist, title: title))
end
end
nil
end
|
#path ⇒ Object
20
21
22
|
# File 'lib/notu/loved_tracks.rb', line 20
def path
'loved'
end
|