Skip to content
Extraits de code Groupes Projets
Valider 81f47161 rédigé par Alexandre Morignot's avatar Alexandre Morignot
Parcourir les fichiers

Tests unitaires et doc

parent a86436bd
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -17,8 +17,14 @@ class SitePlugin ...@@ -17,8 +17,14 @@ class SitePlugin
@@repository.find { |handler| handler.can_handle? site } @@repository.find { |handler| handler.can_handle? site }
end end
# A place holder method. This method *must* be implemented in the subclasses. # Raise an error message if the missing method should have been implemented
def can_handle?(site) # in the subclasse. This possible methode are:
raise "Method not implemented !" # * <tt>#can_handle?</tt>
# * <tt>#get</tt>
#
# They *must* be implemented by the subclasse.
def method_missing(method)
return unless ['can_handle?', 'get'].include(method)
raise "Method #{method} not implemented !"
end end
end end
...@@ -3,13 +3,13 @@ require_relative '../lib/site_plugin.rb' ...@@ -3,13 +3,13 @@ require_relative '../lib/site_plugin.rb'
require 'rubygems' require 'rubygems'
require 'youtube_it' require 'youtube_it'
# SitePlugin for YouTube
class YoutubePlugin < SitePlugin class YoutubePlugin < SitePlugin
def self.can_handle?(site) def self.can_handle?(site)
site =~ /^http:\/\/((www.)?youtube.(fr|com)\/watch\?v=|youtu\.be\/)[a-zA-Z0-9]+$/ site =~ /^http:\/\/((www.)?youtube.(fr|com)\/watch\?v=|youtu\.be\/)[a-zA-Z0-9]+$/
end end
public public
# Store a new youtube api client
def initialize def initialize
@client = YouTubeIt::Client.new @client = YouTubeIt::Client.new
end end
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter