Sha256: 9c11141215bbbaa8291863299151ce4bb5f77e49ce89e7d2a3d9e6675b625853

Contents?: true

Size: 450 Bytes

Versions: 5

Compression:

Stored size: 450 Bytes

Contents

module Convert
  module Converters

    def instagram(string, options = {})
      options = {:height => 714, :width => 616}.merge(options)
      @regex = %r{https?:\/\/(www.)?instagr(am\.com|\.am)/p/.+}

      string.gsub(@regex) do
        string += '/' unless string.end_with?('/')
        %{<iframe src="#{string}embed" height="#{options[:height]}" width="#{options[:width]}" frameborder="0" scrolling="no"></iframe>}
      end
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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