Public feed
#599952
require 'uri'
module Host
#HOST_RE = //
# Returns 'true' value if the handler is capable of processing the url
def handle_url?(u)
u.host =~ @@HOST_RE
end
end
class Example
@@HOST_RE = /example.com$/
class << self
include Host
end
def self.url2img(u)
if u.is_a?(string)
u = URI.parse(u)
end
u.path = '/img' + uri.path + '.jpg'
end
end
Example.handle_url?(URI.parse('http://www.hidebehind.com/6ABA3/')