Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/mac_address.rb

Instance Method Summary collapse

Instance Method Details

#to_macObject



24
25
26
# File 'lib/mac_address.rb', line 24

def to_mac
  MacAddress.new(self).to_s
end

#valid_mac?Boolean

Returns:

  • (Boolean)


28
29
30
31
32
33
34
35
36
# File 'lib/mac_address.rb', line 28

def valid_mac?
  begin
    MacAddress.new(self).to_s
  rescue ArgumentError => e
    return false
  end
  
  true
end