Class: Metallum::Band
- Inherits:
-
Object
- Object
- Metallum::Band
- Defined in:
- lib/metallum/band.rb
Instance Method Summary collapse
- #album_urls ⇒ Object
- #country ⇒ Object
- #genre ⇒ Object
-
#initialize(band_page, discography_page) ⇒ Band
constructor
A new instance of Band.
- #location ⇒ Object
- #logo_url ⇒ Object
- #lyrical_themes ⇒ Object
- #name ⇒ Object
- #photo_url ⇒ Object
- #record_label ⇒ Object
- #status ⇒ Object
- #year_formed ⇒ Object
Constructor Details
#initialize(band_page, discography_page) ⇒ Band
Returns a new instance of Band.
4 5 6 7 |
# File 'lib/metallum/band.rb', line 4 def initialize(band_page, discography_page) @page = band_page @discography = discography_page end |
Instance Method Details
#album_urls ⇒ Object
59 60 61 |
# File 'lib/metallum/band.rb', line 59 def album_urls elements = @discography.search("//tbody//tr//td[1]/a").map { |el| el.attribute("href").text } end |
#country ⇒ Object
14 15 16 17 |
# File 'lib/metallum/band.rb', line 14 def country element = @page.search("//div[@id='band_info']//dl//dd[1]//a") element.children[0].text end |
#genre ⇒ Object
34 35 36 37 |
# File 'lib/metallum/band.rb', line 34 def genre element = @page.search("//div[@id='band_info']//dl[2]//dd[1]") element.text end |
#location ⇒ Object
19 20 21 22 |
# File 'lib/metallum/band.rb', line 19 def location element = @page.search("//div[@id='band_info']//dl[1]//dd[2]") element.text end |
#logo_url ⇒ Object
54 55 56 57 |
# File 'lib/metallum/band.rb', line 54 def logo_url element = @page.search("//a[@id='logo']//img") element.attribute("src").text end |
#lyrical_themes ⇒ Object
39 40 41 42 |
# File 'lib/metallum/band.rb', line 39 def lyrical_themes element = @page.search("//div[@id='band_info']//dl[2]//dd[2]") element.text end |
#name ⇒ Object
9 10 11 12 |
# File 'lib/metallum/band.rb', line 9 def name element = @page.search("h1[@class='band_name']") element.text.strip end |
#photo_url ⇒ Object
49 50 51 52 |
# File 'lib/metallum/band.rb', line 49 def photo_url element = @page.search("//a[@id='photo']//img") element.attribute("src").text end |
#record_label ⇒ Object
44 45 46 47 |
# File 'lib/metallum/band.rb', line 44 def record_label element = @page.search("//div[@id='band_info']//dl[2]//dd[3]") element.text end |
#status ⇒ Object
24 25 26 27 |
# File 'lib/metallum/band.rb', line 24 def status element = @page.search("//div[@id='band_info']//dl[1]//dd[3]") element.text end |
#year_formed ⇒ Object
29 30 31 32 |
# File 'lib/metallum/band.rb', line 29 def year_formed element = @page.search("//div[@id='band_info']//dl//dd[4]") element.text end |