Class: Embedda::Filters::Vimeo

Inherits:
Object
  • Object
show all
Defined in:
lib/embedda/filters/vimeo.rb

Instance Method Summary collapse

Constructor Details

#initialize(protocol, width, height, vimeo_params) ⇒ Vimeo



7
8
9
10
11
12
# File 'lib/embedda/filters/vimeo.rb', line 7

def initialize(protocol, width, height, vimeo_params)
  @protocol = protocol
  @width    = width
  @height   = height
  @vimeo_params= vimeo_params
end

Instance Method Details

#process(string) ⇒ Object



14
15
16
17
18
# File 'lib/embedda/filters/vimeo.rb', line 14

def process(string)
  string.gsub!(/(<a[^>]*?vimeo\.com\/(\d+).*?<\/a>)/i) { |m| player($2) }
  string.gsub!(/([http|https]+:\/\/(?:www\.)?vimeo\.com\/(\d+)\w*)/i) { |m| player($2) }
  return string
end