Sha256: 9f6de9b1113ad2fdda0531c467344dad0d491a7fa4b8017ab3e2d162ef377b9e
Contents?: true
Size: 386 Bytes
Versions: 5
Compression:
Stored size: 386 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) 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/mac.rb |
iz-0.3.0 | lib/iz/mac.rb |
iz-0.2.1 | lib/iz/mac.rb |
iz-0.2.0 | lib/iz/mac.rb |
iz-0.1.0 | lib/iz/mac.rb |