Sha256: 034590e5fa2bbe01ecd3283bcb5c2b15853bf0ed7c36166dc81ba9e58c3a6b2b

Contents?: true

Size: 407 Bytes

Versions: 10

Compression:

Stored size: 407 Bytes

Contents

# frozen_string_literal: true

module UltimateLyrics
  class Provider
    class UrlFormat
      common_constructor :node

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

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

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

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
ultimate_lyrics-0.1.3 lib/ultimate_lyrics/provider/url_format.rb
ehbrs-tools-0.28.3 vendor/ultimate_lyrics/lib/ultimate_lyrics/provider/url_format.rb
ehbrs-tools-0.28.2 vendor/ultimate_lyrics/lib/ultimate_lyrics/provider/url_format.rb
ehbrs-tools-0.28.1 vendor/ultimate_lyrics/lib/ultimate_lyrics/provider/url_format.rb
ultimate_lyrics-0.1.2 lib/ultimate_lyrics/provider/url_format.rb
ehbrs-tools-0.28.0 vendor/ultimate_lyrics/lib/ultimate_lyrics/provider/url_format.rb
ultimate_lyrics-0.1.1 lib/ultimate_lyrics/provider/url_format.rb
ehbrs-tools-0.27.0 vendor/ultimate_lyrics/lib/ultimate_lyrics/provider/url_format.rb
ultimate_lyrics-0.1.0 lib/ultimate_lyrics/provider/url_format.rb
ehbrs-tools-0.26.0 vendor/ultimate_lyrics/lib/ultimate_lyrics/provider/url_format.rb