Class: VagrantPlugins::Share::Helper::WordList

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-share/helper/word_list.rb

Constant Summary collapse

LIST =

Word list content

{"even"=>
{"01"=>"roman",
"02"=>"forward",
"03"=>"club",
"04"=>"static",
"05"=>"sample",
"06"=>"opera",
"07"=>"polygon",
"08"=>"transit",
"09"=>"fidel",
"0A"=>"mixer",
"0B"=>"jacket",
"0C"=>"celtic",
"0D"=>"phone",
"0E"=>"bambino",
"0F"=>"igloo",
"10"=>"door",
"11"=>"omega",
"12"=>"basket",
"13"=>"distant",
"14"=>"frog",
"15"=>"leopard",
"16"=>"smart",
"17"=>"hilton",
"18"=>"panel",
"19"=>"empire",
"1A"=>"product",
"1B"=>"enigma",
"1C"=>"alice",
"1D"=>"sweet",
"1E"=>"banjo",
"1F"=>"golf",
"20"=>"sphere",
"21"=>"culture",
"22"=>"people",
"23"=>"libra",
"24"=>"vega",
"25"=>"dynasty",
"26"=>"inca",
"27"=>"modem",
"28"=>"koala",
"29"=>"basic",
"2A"=>"jamaica",
"2B"=>"yankee",
"2C"=>"august",
"2D"=>"crimson",
"2E"=>"alaska",
"2F"=>"fabric",
"30"=>"bazaar",
"31"=>"compact",
"32"=>"tractor",
"33"=>"geneva",
"34"=>"potato",
"35"=>"melon",
"36"=>"novel",
"37"=>"instant",
"38"=>"brazil",
"39"=>"adios",
"3A"=>"hunter",
"3B"=>"kilo",
"3C"=>"everest",
"3D"=>"pamela",
"3E"=>"clock",
"3F"=>"diego",
"40"=>"caviar",
"41"=>"melody",
"42"=>"orange",
"43"=>"budget",
"44"=>"motor",
"45"=>"october",
"46"=>"object",
"47"=>"samba",
"48"=>"regular",
"49"=>"export",
"4A"=>"person",
"4B"=>"energy",
"4C"=>"demo",
"4D"=>"angel",
"4E"=>"printer",
"4F"=>"savage",
"50"=>"evening",
"51"=>"bonus",
"52"=>"shelter",
"53"=>"origin",
"54"=>"logic",
"55"=>"maximum",
"56"=>"comedy",
"57"=>"liquid",
"58"=>"humor",
"59"=>"collect",
"5A"=>"equator",
"5B"=>"monday",
"5C"=>"monarch",
"5D"=>"pony",
"5E"=>"silk",
"5F"=>"balloon",
"60"=>"educate",
"61"=>"leonid",
"62"=>"aztec",
"63"=>"harbor",
"64"=>"sabrina",
"65"=>"palace",
"66"=>"kimono",
"67"=>"group",
"68"=>"panther",
"69"=>"snake",
"6A"=>"project",
"6B"=>"cobra",
"6C"=>"casino",
"6D"=>"optimal",
"6E"=>"chess",
"6F"=>"tempo",
"70"=>"bikini",
"71"=>"address",
"72"=>"toga",
"73"=>"target",
"74"=>"depend",
"75"=>"gong",
"76"=>"company",
"77"=>"vanilla",
"78"=>"isotope",
"79"=>"tornado",
"7A"=>"union",
"7B"=>"plasma",
"7C"=>"film",
"7D"=>"marvin",
"7E"=>"annual",
"7F"=>"athena",
"80"=>"finance",
"81"=>"escape",
"82"=>"germany",
"83"=>"brother",
"84"=>"fragile",
"85"=>"patriot",
"86"=>"camera",
"87"=>"paradox",
"88"=>"atomic",
"89"=>"switch",
"8A"=>"hamlet",
"8B"=>"hawaii",
"8C"=>"consul",
"8D"=>"lucas",
"8E"=>"begin",
"8F"=>"lithium",
"90"=>"multi",
"91"=>"fruit",
"92"=>"jungle",
"93"=>"ecology",
"94"=>"solo",
"95"=>"right",
"96"=>"little",
"97"=>"planet",
"98"=>"vodka",
"99"=>"cherry",
"9A"=>"cafe",
"9B"=>"today",
"9C"=>"gravity",
"9D"=>"neptune",
"9E"=>"import",
"9F"=>"vitamin",
"A0"=>"salami",
"A1"=>"section",
"A2"=>"percent",
"A3"=>"forum",
"A4"=>"ethnic",
"A5"=>"portal",
"A6"=>"rainbow",
"A7"=>"concert",
"A8"=>"empty",
"A9"=>"sultan",
"AA"=>"galileo",
"AB"=>"mega",
"AC"=>"elegant",
"AD"=>"ferrari",
"AE"=>"tina",
"AF"=>"rival",
"B0"=>"galaxy",
"B1"=>"numeric",
"B2"=>"member",
"B3"=>"laser",
"B4"=>"mars",
"B5"=>"clean",
"B6"=>"optic",
"B7"=>"remote",
"B8"=>"pretend",
"B9"=>"hotel",
"BA"=>"zipper",
"BB"=>"burma",
"BC"=>"aroma",
"BD"=>"soda",
"BE"=>"stereo",
"BF"=>"london",
"C0"=>"crown",
"C1"=>"aloha",
"C2"=>"boxer",
"C3"=>"texas",
"C4"=>"george",
"C5"=>"morning",
"C6"=>"combine",
"C7"=>"contour",
"C8"=>"clinic",
"C9"=>"total",
"CA"=>"amanda",
"CB"=>"tahiti",
"CC"=>"trilogy",
"CD"=>"marble",
"CE"=>"chapter",
"CF"=>"agenda",
"D0"=>"lima",
"D1"=>"audio",
"D2"=>"episode",
"D3"=>"nobel",
"D4"=>"mambo",
"D5"=>"extend",
"D6"=>"crater",
"D7"=>"trapeze",
"D8"=>"magnet",
"D9"=>"graph",
"DA"=>"pupil",
"DB"=>"lady",
"DC"=>"canvas",
"DD"=>"nominal",
"DE"=>"blitz",
"DF"=>"eclipse",
"E0"=>"lemon",
"E1"=>"trick",
"E2"=>"vatican",
"E3"=>"delta",
"E4"=>"venus",
"E5"=>"young",
"E6"=>"opinion",
"E7"=>"studio",
"E8"=>"western",
"E9"=>"salary",
"EA"=>"senator",
"EB"=>"william",
"EC"=>"diet",
"ED"=>"abraham",
"EE"=>"package",
"EF"=>"aspect",
"F0"=>"fiction",
"F1"=>"santana",
"F2"=>"cairo",
"F3"=>"bishop",
"F4"=>"shrink",
"F5"=>"garage",
"F6"=>"korea",
"F7"=>"binary",
"F8"=>"jasmine",
"F9"=>"sigma",
"FA"=>"dollar",
"FB"=>"control",
"FC"=>"france",
"FD"=>"organic",
"FE"=>"system",
"FF"=>"water"},
        "odd"=>
{"01"=>"amigo",
"02"=>"album",
"03"=>"deluxe",
"04"=>"grille",
"05"=>"alarm",
"06"=>"design",
"07"=>"cable",
"08"=>"avenue",
"09"=>"spring",
"0A"=>"jargon",
"0B"=>"tokyo",
"0C"=>"analog",
"0D"=>"madonna",
"0E"=>"liberal",
"0F"=>"python",
"10"=>"bernard",
"11"=>"prepare",
"12"=>"sulfur",
"13"=>"sahara",
"14"=>"kitchen",
"15"=>"denver",
"16"=>"develop",
"17"=>"history",
"18"=>"john",
"19"=>"viking",
"1A"=>"soviet",
"1B"=>"social",
"1C"=>"madrid",
"1D"=>"guitar",
"1E"=>"medical",
"1F"=>"alex",
"20"=>"axiom",
"21"=>"gamma",
"22"=>"mile",
"23"=>"diana",
"24"=>"zero",
"25"=>"crash",
"26"=>"rose",
"27"=>"saturn",
"28"=>"machine",
"29"=>"script",
"2A"=>"inch",
"2B"=>"oregano",
"2C"=>"tropic",
"2D"=>"helena",
"2E"=>"gemini",
"2F"=>"museum",
"30"=>"ramirez",
"31"=>"ninja",
"32"=>"laptop",
"33"=>"change",
"34"=>"declare",
"35"=>"effect",
"36"=>"asia",
"37"=>"radar",
"38"=>"lucky",
"39"=>"spain",
"3A"=>"modern",
"3B"=>"pump",
"3C"=>"fresh",
"3D"=>"secret",
"3E"=>"limbo",
"3F"=>"maxwell",
"40"=>"coral",
"41"=>"method",
"42"=>"public",
"43"=>"tommy",
"44"=>"carbon",
"45"=>"courage",
"46"=>"telex",
"47"=>"david",
"48"=>"vincent",
"49"=>"famous",
"4A"=>"resume",
"4B"=>"miami",
"4C"=>"filter",
"4D"=>"heroic",
"4E"=>"model",
"4F"=>"process",
"50"=>"summer",
"51"=>"vampire",
"52"=>"indigo",
"53"=>"driver",
"54"=>"extreme",
"55"=>"meteor",
"56"=>"eternal",
"57"=>"italian",
"58"=>"orlando",
"59"=>"parker",
"5A"=>"dolphin",
"5B"=>"almond",
"5C"=>"chicken",
"5D"=>"ceramic",
"5E"=>"neutral",
"5F"=>"video",
"60"=>"carpet",
"61"=>"master",
"62"=>"loyal",
"63"=>"liter",
"64"=>"music",
"65"=>"camel",
"66"=>"memo",
"67"=>"jeep",
"68"=>"austria",
"69"=>"norway",
"6A"=>"morgan",
"6B"=>"kermit",
"6C"=>"bottle",
"6D"=>"partner",
"6E"=>"imagine",
"6F"=>"chef",
"70"=>"meter",
"71"=>"lexicon",
"72"=>"risk",
"73"=>"event",
"74"=>"mozart",
"75"=>"turbo",
"76"=>"corona",
"77"=>"select",
"78"=>"insect",
"79"=>"granite",
"7A"=>"reptile",
"7B"=>"status",
"7C"=>"style",
"7D"=>"carmen",
"7E"=>"network",
"7F"=>"nevada",
"80"=>"figure",
"81"=>"panda",
"82"=>"biscuit",
"83"=>"message",
"84"=>"wizard",
"85"=>"mirage",
"86"=>"police",
"87"=>"immune",
"88"=>"brain",
"89"=>"mentor",
"8A"=>"complex",
"8B"=>"desert",
"8C"=>"citizen",
"8D"=>"house",
"8E"=>"uncle",
"8F"=>"cuba",
"90"=>"exhibit",
"91"=>"cartoon",
"92"=>"alamo",
"93"=>"algebra",
"94"=>"express",
"95"=>"wolf",
"96"=>"nothing",
"97"=>"quiet",
"98"=>"prosper",
"99"=>"simple",
"9A"=>"poetic",
"9B"=>"sector",
"9C"=>"blonde",
"9D"=>"sport",
"9E"=>"titanic",
"9F"=>"agent",
"A0"=>"extra",
"A1"=>"email",
"A2"=>"candle",
"A3"=>"sensor",
"A4"=>"gorilla",
"A5"=>"mimic",
"A6"=>"bronze",
"A7"=>"sharp",
"A8"=>"climax",
"A9"=>"pasta",
"AA"=>"storm",
"AB"=>"perfect",
"AC"=>"cecilia",
"AD"=>"prize",
"AE"=>"popcorn",
"AF"=>"horizon",
"B0"=>"oxygen",
"B1"=>"helium",
"B2"=>"virtual",
"B3"=>"salmon",
"B4"=>"tower",
"B5"=>"protect",
"B6"=>"baker",
"B7"=>"roger",
"B8"=>"tripod",
"B9"=>"theory",
"BA"=>"period",
"BB"=>"crystal",
"BC"=>"genesis",
"BD"=>"nina",
"BE"=>"olivia",
"BF"=>"dialog",
"C0"=>"ralph",
"C1"=>"america",
"C2"=>"mary",
"C3"=>"option",
"C4"=>"english",
"C5"=>"food",
"C6"=>"lobby",
"C7"=>"iceberg",
"C8"=>"shock",
"C9"=>"tunnel",
"CA"=>"kayak",
"CB"=>"oxford",
"CC"=>"paper",
"CD"=>"deliver",
"CE"=>"jumbo",
"CF"=>"friend",
"D0"=>"hello",
"D1"=>"british",
"D2"=>"recycle",
"D3"=>"java",
"D4"=>"gossip",
"D5"=>"riviera",
"D6"=>"record",
"D7"=>"price",
"D8"=>"artist",
"D9"=>"reply",
"DA"=>"lobster",
"DB"=>"trident",
"DC"=>"yoyo",
"DD"=>"impact",
"DE"=>"textile",
"DF"=>"coconut",
"E0"=>"junior",
"E1"=>"rondo",
"E2"=>"robert",
"E3"=>"bermuda",
"E4"=>"silence",
"E5"=>"million",
"E6"=>"media",
"E7"=>"factor",
"E8"=>"freedom",
"E9"=>"echo",
"EA"=>"taxi",
"EB"=>"botanic",
"EC"=>"native",
"ED"=>"limit",
"EE"=>"queen",
"EF"=>"salon",
"F0"=>"human",
"F1"=>"patrol",
"F2"=>"juliet",
"F3"=>"elvis",
"F4"=>"square",
"F5"=>"montana",
"F6"=>"school",
"F7"=>"harvest",
"F8"=>"iris",
"F9"=>"oasis",
"FA"=>"good",
"FB"=>"suzuki",
"FC"=>"tuna",
"FD"=>"strong",
"FE"=>"vocal",
"FF"=>"pigment"}}

Class Method Summary collapse

Class Method Details

.decode(words) ⇒ Integer

Decode given words to number

Parameters:

  • words (Array<String>)

Returns:

  • (Integer)


539
540
541
542
543
544
545
546
# File 'lib/vagrant-share/helper/word_list.rb', line 539

def self.decode(words)
  result = ""
  words.each_with_index do |word, idx|
    key = idx % 2 == 1 ? "odd" : "even"
    result << LIST[key].key(word).to_s
  end
  result.to_i(16)
end

.encode(number) ⇒ Array<String>

Encode given number to words

Parameters:

  • number (Integer)

Returns:

  • (Array<String>)


524
525
526
527
528
529
530
531
532
533
# File 'lib/vagrant-share/helper/word_list.rb', line 524

def self.encode(number)
  hex = number.to_s(16)
  hex = "0#{hex}" if hex.size % 2 == 1
  result = []
  hex.scan(/.{2}/).each_with_index do |value, idx|
    key = idx % 2 == 1 ? "odd" : "even"
    result << LIST[key][value.upcase]
  end
  result.compact
end