Class: Yast::AddressClass
- Inherits:
-
Module
- Object
- Module
- Yast::AddressClass
- Defined in:
- library/types/src/modules/Address.rb
Instance Method Summary collapse
-
#Check(address) ⇒ Object
Check syntax of a network address (IP address or hostname).
-
#Check4(address) ⇒ Object
Check syntax of a network address (ip4 or name).
-
#Check6(address) ⇒ Object
Check syntax of a network address (ip6 or name).
-
#CheckMAC(address) ⇒ Object
Check syntax of MAC address.
- #main ⇒ Object
-
#Valid4 ⇒ Object
Return a description of a valid address (ip4 or name).
-
#ValidMAC ⇒ String
Describe a valid MAC address.
Instance Method Details
#Check(address) ⇒ Object
Check syntax of a network address (IP address or hostname)
70 71 72 |
# File 'library/types/src/modules/Address.rb', line 70 def Check(address) Check4(address) || Check6(address) end |
#Check4(address) ⇒ Object
Check syntax of a network address (ip4 or name)
56 57 58 |
# File 'library/types/src/modules/Address.rb', line 56 def Check4(address) IP.Check4(address) || Hostname.CheckFQ(address) end |
#Check6(address) ⇒ Object
Check syntax of a network address (ip6 or name)
63 64 65 |
# File 'library/types/src/modules/Address.rb', line 63 def Check6(address) IP.Check6(address) || Hostname.CheckFQ(address) end |
#CheckMAC(address) ⇒ Object
Check syntax of MAC address
86 87 88 89 90 91 92 93 |
# File 'library/types/src/modules/Address.rb', line 86 def CheckMAC(address) return false if address.nil? || address == "" regexp = "[0-9a-fA-F]{2,2}" regexp = Builtins.sformat("(%1:){5,5}%1", regexp) Builtins.regexpmatch(address, regexp) end |
#main ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'library/types/src/modules/Address.rb', line 35 def main textdomain "base" Yast.import "Hostname" Yast.import "IP" @ValidChars = Ops.add(Hostname.ValidChars, IP.ValidChars) @ValidChars4 = Ops.add(Hostname.ValidChars, IP.ValidChars4) @ValidChars6 = Ops.add(Hostname.ValidChars, IP.ValidChars6) @ValidCharsMAC = "0123456789abcdefABCDEF:" end |
#Valid4 ⇒ Object
Return a description of a valid address (ip4 or name)
49 50 51 |
# File 'library/types/src/modules/Address.rb', line 49 def Valid4 Ops.add(Ops.add(IP.Valid4, "\n"), Hostname.ValidFQ) end |
#ValidMAC ⇒ String
Describe a valid MAC address
76 77 78 79 80 81 |
# File 'library/types/src/modules/Address.rb', line 76 def ValidMAC # describe valid MAC address _( "A valid MAC address consists of six pairs of hexadecimal\ndigits separated by colons." ) end |