Sha256: 8daef1995735d49e47e8f3cf11a6fd65ff88b09d174d0ea81f168399de5b2868
Contents?: true
Size: 754 Bytes
Versions: 1
Compression:
Stored size: 754 Bytes
Contents
module ForemanNameGenerator 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
foreman_name_generator-0.0.2 | lib/foreman_name_generator/mac_generator.rb |