Class: Embedit::Provider

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

Constant Summary collapse

@@list =

require all providers and collect the names

Dir["#{File.dirname(__FILE__)}/providers/*.rb"].collect {|file| require(file); "Embedit::#{File.basename(file,'.rb').classify}".constantize }

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#formatObject (readonly)

Returns the value of attribute format.



5
6
7
# File 'lib/embedit/provider.rb', line 5

def format
  @format
end

#htmlObject (readonly)

Returns the value of attribute html.



5
6
7
# File 'lib/embedit/provider.rb', line 5

def html
  @html
end

#titleObject (readonly)

Returns the value of attribute title.



5
6
7
# File 'lib/embedit/provider.rb', line 5

def title
  @title
end

#urlObject (readonly)

Returns the value of attribute url.



5
6
7
# File 'lib/embedit/provider.rb', line 5

def url
  @url
end

Class Method Details

.allObject



11
12
13
# File 'lib/embedit/provider.rb', line 11

def all
  @@list
end

.eachObject



15
16
17
18
19
# File 'lib/embedit/provider.rb', line 15

def each
  all.each do |provider|
    yield provider
  end
end

.find(url) ⇒ Object



21
22
23
24
25
26
# File 'lib/embedit/provider.rb', line 21

def find(url)
  each do |provider|
    return provider.new(url) if provider.match(url)
  end
  nil # if no provider found
end