Class: String

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

Instance Method Summary collapse

Instance Method Details

#embedda(options = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/embedda.rb', line 4

def embedda(options = {})
  options = {:filters => [:youtube, :vimeo, :soundcloud]}.merge(options)

  # Make sure that filters is an array because we allow the short form of
  # "hello".embedda(:filters => :youtube) instead of "hello".embedda(:filters => [:youtube])
  options[:filters] = Array(options[:filters])

  compiled = self
  compiled = youtube_replace(compiled)    if options[:filters].include?(:youtube)
  compiled = vimeo_replace(compiled)      if options[:filters].include?(:vimeo)
  compiled = soundcloud_replace(compiled) if options[:filters].include?(:soundcloud)

  return compiled
end