Sha256: bfbbfec0ad851dfc35a710d37007f64d15196aeae3f2e187910db7ed67c147db

Contents?: true

Size: 549 Bytes

Versions: 1

Compression:

Stored size: 549 Bytes

Contents

# 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(/'.*/, '').gsub(/,.*/, '').gsub('/:', '/')
        end
        .map do |x|
          if x.scan(')').count == 2
            x.gsub(/\)\).*/, ')')
          elsif x.scan(')').count == 1
            x.gsub(/\).*/, '')
          else
            x
          end
        end
    end

    def links_find(content)
      URI.extract(content, /http()s?/)
    end
  end # class
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
awesome_bot-1.3.1 lib/awesome_bot/links.rb