Sha256: 7e35ee9455e1b578ae723ec78fb75cca50f9fa9b028c31dab83c3667ca24cdde

Contents?: true

Size: 333 Bytes

Versions: 5

Compression:

Stored size: 333 Bytes

Contents

module Iz
  class Url
    REGEX = /^(?:\w+:)?\/\/([^\s\.]+\.\S{2}|localhost[\:?\d]*)\S*$/i

    attr_accessor :value

    def initialize(url)
      self.value = url
    end

    def valid?
      !!Iz::Url.is_url?(value)
    end

    def self.is_url?(value)
      return false unless value
      value.to_s =~ REGEX
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
iz-0.3.1 lib/iz/url.rb
iz-0.3.0 lib/iz/url.rb
iz-0.2.1 lib/iz/url.rb
iz-0.2.0 lib/iz/url.rb
iz-0.1.0 lib/iz/url.rb