Class: UltimateLyrics::Provider::UrlFormat

Inherits:
Object
  • Object
show all
Defined in:
lib/ultimate_lyrics/provider/url_format.rb

Instance Method Summary collapse

Instance Method Details

#apply(value) ⇒ Object



8
9
10
# File 'lib/ultimate_lyrics/provider/url_format.rb', line 8

def apply(value)
  replace_chars.inject(value) { |a, e| a.gsub(e, with) }
end

#replace_charsObject



12
13
14
# File 'lib/ultimate_lyrics/provider/url_format.rb', line 12

def replace_chars
  ::CGI.unescapeHTML(node.attribute('replace').text).each_char.to_a
end

#withObject



16
17
18
# File 'lib/ultimate_lyrics/provider/url_format.rb', line 16

def with
  node.attribute('with').text
end