Class: ElVallenato::Letra

Inherits:
Object
  • Object
show all
Defined in:
lib/elvallenato/letra.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content) ⇒ Letra

Returns a new instance of Letra.



8
9
10
11
# File 'lib/elvallenato/letra.rb', line 8

def initialize(content)
  @content = content
  @doc = Nokogiri::HTML(@content)
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



6
7
8
# File 'lib/elvallenato/letra.rb', line 6

def content
  @content
end

Instance Method Details

#artistObject



25
26
27
# File 'lib/elvallenato/letra.rb', line 25

def artist
  @artist ||= @doc.search("td .text_std")[8].text
end

#bodyObject



17
18
19
# File 'lib/elvallenato/letra.rb', line 17

def body
  @body ||= @doc.search("td .text_std")[6].inner_html
end

#composerObject



21
22
23
# File 'lib/elvallenato/letra.rb', line 21

def composer
  @composer ||= @doc.search("td .text_std")[9].text
end

#titleObject



13
14
15
# File 'lib/elvallenato/letra.rb', line 13

def title
  @title ||= @doc.at(".text_title").text
end