class AutoHtml::Instagram

Instagram filter

Public Class Methods

new(width: 616, height: 714) click to toggle source
# File lib/auto_html/instagram.rb, line 8
def initialize(width: 616, height: 714)
  @width = width
  @height = height
end

Public Instance Methods

call(text) click to toggle source
# File lib/auto_html/instagram.rb, line 13
def call(text)
  text << '/' unless text.end_with?('/')
  text.gsub(instagram_pattern) do
    tag(
      :iframe,
      src: "#{text}embed",
      height: @height,
      width: @width,
      frameborder: 0,
      scrolling: 'no') { '' }
  end
end

Private Instance Methods

instagram_pattern() click to toggle source
# File lib/auto_html/instagram.rb, line 28
def instagram_pattern
  @instagram_pattern ||= %r{https?:\/\/(www.)?instagr(am\.com|\.am)/p/.+}
end