Module: CalendarAssistant::StringHelpers

Defined in:
lib/calendar_assistant/string_helpers.rb

Class Method Summary collapse

Class Method Details

.find_uri_for_domain(string, domain) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/calendar_assistant/string_helpers.rb', line 3

def self.find_uri_for_domain(string, domain)
  return unless string
  URI::Parser.new.extract(string).each do |uri_string|
    uri = URI.parse uri_string
    return uri_string if uri.hostname =~ /\.#{domain}$/
  end
  nil
end