module EmbedRb::Base

Public Instance Methods

embed() click to toggle source
# File lib/embedrb/base.rb, line 9
def embed()
  @input.scan(@regex) {|match|
    url = match[0]
    if !@options[:served].include? url && EmbedRb.process_more?(@options, @service, @embeds)
      text = url_to_text match
      if text
        @options[:served] << url
        @embeds << {
          :key => url,
          :text => text
        }
      end
    end
  }
end
process() click to toggle source
# File lib/embedrb/base.rb, line 4
def process()
  embed
  @output
end
shorten(url) click to toggle source
# File lib/embedrb/base.rb, line 30
def shorten(url)
  url.gsub(/http(s?):\/\/(www\.|m\.|)/, '')
end
url_to_text(matched) click to toggle source
# File lib/embedrb/base.rb, line 25
def url_to_text(matched)
  url = matched[0]
  return render url
end