Class: OembedProxy::Handler
- Inherits:
-
Object
- Object
- OembedProxy::Handler
- Defined in:
- lib/oembed_proxy/handler.rb
Overview
Generic composing handler
Instance Method Summary collapse
- #get_data(url, other_params = {}) ⇒ Object
- #handles_url?(url) ⇒ Boolean
-
#initialize(*providers) ⇒ Handler
constructor
A new instance of Handler.
- #register(provider) ⇒ Object
Constructor Details
#initialize(*providers) ⇒ Handler
Returns a new instance of Handler.
6 7 8 |
# File 'lib/oembed_proxy/handler.rb', line 6 def initialize(*providers) @registered_providers = providers end |
Instance Method Details
#get_data(url, other_params = {}) ⇒ Object
18 19 20 21 |
# File 'lib/oembed_proxy/handler.rb', line 18 def get_data(url, other_params = {}) provider = provider_for_url(url) return provider.get_data(url, other_params) unless provider.nil? end |
#handles_url?(url) ⇒ Boolean
14 15 16 |
# File 'lib/oembed_proxy/handler.rb', line 14 def handles_url?(url) !provider_for_url(url).nil? end |
#register(provider) ⇒ Object
10 11 12 |
# File 'lib/oembed_proxy/handler.rb', line 10 def register(provider) @registered_providers << provider end |