Sha256: 966b50e9c7b69425ca69aaa5c4797f65ed4c610e2f0a06bb1813b1969a22f897
Contents?: true
Size: 740 Bytes
Versions: 2
Compression:
Stored size: 740 Bytes
Contents
module Deacon class MacGenerator < Generator def generate(mac, female = false) return [] if mac.nil? || mac.empty? # B0 B1 B2 B3 B4 B5 # SHRT0 SHRT1 SHRT2 bytes = mac_to_bytes(mac) shorts = mac_to_shorts(mac) filename = (shorts[0] & 0x1) == 0 ? GIVEN_MALE_NAMES_FILE : GIVEN_FEMALE_NAMES_FILE firstname1 = find_name(bytes[2], data_file(filename), RECORD_LENGTH_GIVEN) firstname2 = find_name(bytes[3], data_file(filename), RECORD_LENGTH_GIVEN) surname1 = find_name(shorts[0], data_file(SURNAMES_FILE), RECORD_LENGTH_SURNAME) surname2 = find_name(shorts[2], data_file(SURNAMES_FILE), RECORD_LENGTH_SURNAME) [firstname2, firstname1, surname1, surname2] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
deacon-1.0.0 | lib/deacon/mac_generator.rb |
deacon-0.0.3 | lib/deacon/mac_generator.rb |