Sha256: c8ad23618b153cbb45499730746060c47bc5900de979be6596b316b356501151
Contents?: true
Size: 646 Bytes
Versions: 15
Compression:
Stored size: 646 Bytes
Contents
require 'murlsh' module Murlsh # Convert urls specifically for use on mobile devices into their non-mobile # equivalents. class AddPre40ConvertMobile < Plugin @hook = 'add_pre' TwitterRe = %r{^(http://)mobile\.(twitter\.com/.*)$}i WikipediaRe = %r{^(http://[a-z]+\.)m\.(wikipedia\.org/.*)$}i def self.unmobile(url) case when match = TwitterRe.match(url); "#{match[1]}#{match[2]}" when match = WikipediaRe.match(url); "#{match[1]}#{match[2]}" else; url end end def self.run(url, config) url.url = unmobile(url.url) url.via = unmobile(url.via) end end end
Version data entries
15 entries across 15 versions & 1 rubygems