Class: Iz::Mac
- Inherits:
-
Object
- Object
- Iz::Mac
- Defined in:
- lib/iz/mac.rb
Constant Summary collapse
- 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}))$/
Instance Attribute Summary collapse
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(mac) ⇒ Mac
constructor
A new instance of Mac.
- #valid? ⇒ Boolean
Constructor Details
#initialize(mac) ⇒ Mac
Returns a new instance of Mac.
7 8 9 |
# File 'lib/iz/mac.rb', line 7 def initialize(mac) self.value = mac end |
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
5 6 7 |
# File 'lib/iz/mac.rb', line 5 def value @value end |
Class Method Details
.is_mac?(value) ⇒ Boolean
15 16 17 18 |
# File 'lib/iz/mac.rb', line 15 def self.is_mac?(value) return false unless value value.to_s =~ REGEX end |