Sha256: bcfbc668d1a7c23198ea5da47dab48c50381a3b4e59e2b7da724638a13c7a822

Contents?: true

Size: 365 Bytes

Versions: 2

Compression:

Stored size: 365 Bytes

Contents

module Orthotypo
  class Analyzer

    def self.url?(string)
      uri = URI.parse(string)
      uri.class != URI::Generic
    rescue URI::InvalidURIError
      false
    end

    def self.email?(string)
      string =~ /\A#{URI::MailTo::EMAIL_REGEXP}\z/ ? true : false
    end

    def self.precious?(string)
      email?(string) || url?(string)
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
orthotypo-1.0.4 lib/orthotypo/analyzer.rb
orthotypo-1.0.3 lib/orthotypo/analyzer.rb