lib/awesome_bot/links.rb in awesome_bot-1.8.1 vs lib/awesome_bot/links.rb in awesome_bot-1.8.2
- old
+ new
@@ -1,9 +1,7 @@
# Get and filter links
module AwesomeBot
- require 'uri'
-
class << self
def links_filter(list)
list.reject { |x| x.length < 9 }
.map do |x|
x.gsub(',','%2c').gsub(/'.*/, '').gsub(/,.*/, '').gsub('/:', '/')
@@ -15,16 +13,19 @@
x.gsub(/\)\).*/, ')')
elsif x.scan(')').count > 0
x.gsub(/\).*/, '')
elsif x.include? '[' # adoc
x.gsub(/\[.*/, '')
+ elsif x[-1]=='.'
+ x[0..-2]
else
x
end
end
end
def links_find(content)
+ require 'uri'
URI.extract(content, /http()s?/)
end
end # class
end