Sha256: 8f5a30bad916aabb8efc4c9d6ffc04b38bd06b6d6f9a14b121381d38bfa3de80

Contents?: true

Size: 455 Bytes

Versions: 4

Compression:

Stored size: 455 Bytes

Contents

module Orthotypo
  class Analyzer

    def self.url?(string)
      (string =~ /\A#{URI::DEFAULT_PARSER.regexp[:ABS_URI]}\z/) && 
      (string =~ /\A(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?\z/ix) ? true : 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

4 entries across 4 versions & 1 rubygems

Version Path
orthotypo-1.0.2 lib/orthotypo/analyzer.rb
orthotypo-1.0.1 lib/orthotypo/analyzer.rb
orthotypo-1.0.0 lib/orthotypo/analyzer.rb
orthotypo-0.6.0 lib/orthotypo/analyzer.rb