lib/embeddable/concerns/embeddable.rb in embeddable-0.0.1 vs lib/embeddable/concerns/embeddable.rb in embeddable-0.0.2

- old
+ new

@@ -6,25 +6,16 @@ SERVICES = { youtube: [ %r{^https?://(?:(?:www|m)\.)?youtube\.com/watch\?v=([^&]+)}, %r{^https?://(?:(?:www|m)\.)?youtu\.be/([^?]+)} + ], + vimeo: [ + %r{^https?://(?:www\.)?vimeo\.com/([^\?]+)}, ] } module ClassMethods - # Denotes an embeddable for given name - # - # Options: - # :from (source property for this embeddable, required) - # - # Example: - # - # class Post - # include Concerns::Embeddable - # embeddable :video, from: :video_url - # end - # def embeddable(name, options = {}) source = options.fetch :from define_method "#{name}_type" do url = send(source)