Sha256: fcd2c2123e4d7d18f04682f696544621e8719eee15c4f9b79521a96b9d41e4fb

Contents?: true

Size: 843 Bytes

Versions: 5

Compression:

Stored size: 843 Bytes

Contents

module Convert
  module Converters

    # Convert worldstar movie URL to embedded html
    def worldstar(string, options = {})
      # Original: 448 374
      options = {:width => 590, :height => 335}.merge(options)

      @regex = /http:\/\/www\.worldstarhiphop\.com\/videos\/video\.php\?v\=(wshh[A-Za-z0-9]+)/

      string.gsub(@regex) do
        video_id = $1
        width  = options[:width]
        height = options[:height]
        %{<object width="#{width}" height="#{height}"><param name="movie" value="http://www.worldstarhiphop.com/videos/e/16711680/#{video_id}"><param name="allowFullScreen" value="true"></param><embed src="http://www.worldstarhiphop.com/videos/e/16711680/#{video_id}" type="application/x-shockwave-flash" allowFullscreen="true" width="#{width}" height="#{height}"></embed></object>}
      end
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
convert-0.1.7 lib/converters/worldstar.rb
convert-0.1.6 lib/converters/worldstar.rb
convert-0.1.5 lib/converters/worldstar.rb
convert-0.1.4 lib/converters/worldstar.rb
convert-0.1.3 lib/converters/worldstar.rb