Sha256: 9e056e615c95563de6827ca09d0cbb7fe3edc8eb848c60cb52e0bb4af27e6f0b

Contents?: true

Size: 352 Bytes

Versions: 1

Compression:

Stored size: 352 Bytes

Contents

module Iz
  class Mac
    REGEX = /^(([0-9A-Fa-f]{2}[:\.-]){5}([0-9A-Fa-f]{2}))|([0-9A-Fa-f]{12})|(([0-9A-Fa-f]{4}[:\.-]){2}([0-9A-Fa-f]{4}))$/

    attr_accessor :value

    def initialize(mac)
      self.value = mac
    end

    def valid?
      Iz::Mac.is_mac?(value)
    end

    def self.is_mac?(value)
      value.to_s =~ REGEX
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
iz-0.0.1 lib/iz/mac.rb