Module: EmbedRb::Base
- Included in:
- BasicAudio, BasicImage, BasicVideo, Flickr, Instagram, OpenGraph, Ted, Ustream, YouTube
- Defined in:
- lib/embedrb/base.rb
Instance Method Summary collapse
Instance Method Details
#embed ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/embedrb/base.rb', line 9 def () @input.scan(@regex) {|match| url = match[0] if ![:served].include? url && EmbedRb.process_more?(, @service, ) text = url_to_text match if text [:served] << url << { :key => url, :text => text } end end } end |
#process ⇒ Object
4 5 6 7 |
# File 'lib/embedrb/base.rb', line 4 def process() @output end |
#shorten(url) ⇒ Object
30 31 32 |
# File 'lib/embedrb/base.rb', line 30 def shorten(url) url.gsub(/http(s?):\/\/(www\.|m\.|)/, '') end |
#url_to_text(matched) ⇒ Object
25 26 27 28 |
# File 'lib/embedrb/base.rb', line 25 def url_to_text(matched) url = matched[0] return render url end |