class ArticleJSON::Import::GoogleDoc::HTML::EmbeddedSlideshareParser
Public Class Methods
url_regexp()
click to toggle source
Regular expression to check if a given string is a Slideshare URL Also used to extract HANDLE and ID from the URL. @return [Regexp]
# File lib/article_json/import/google_doc/html/embedded_slideshare_parser.rb, line 23 def url_regexp %r{ ^\S* # all protocols & sub domains slideshare\.net/ # domain (?<handle>[^/\s]+)/ # username / handle (?<id>[^/?&\s\u00A0]+) # the id / slug of the slide show }xi end
Public Instance Methods
embed_id()
click to toggle source
Extract the slide show ID (including the handle) from an URL @return [String]
# File lib/article_json/import/google_doc/html/embedded_slideshare_parser.rb, line 14 def embed_id match = @node.inner_text.strip.match(self.class.url_regexp) "#{match[:handle]}/#{match[:id]}" if match end
embed_type()
click to toggle source
The type of this embedded element @return [Symbol]
# File lib/article_json/import/google_doc/html/embedded_slideshare_parser.rb, line 8 def embed_type :slideshare end