module FFaker::NatoAlphabet

Constants

CODES
STOP_CODE

Public Instance Methods

alphabetic_code() click to toggle source
# File lib/ffaker/nato_alphabet.rb, line 15
def alphabetic_code
  fetch_sample(ALPHABET_CODES)
end
callsign() click to toggle source
# File lib/ffaker/nato_alphabet.rb, line 23
def callsign
  codify('?-?-#')
end
code() click to toggle source
# File lib/ffaker/nato_alphabet.rb, line 11
def code
  fetch_sample(CODES)
end
codify(masks) click to toggle source
# File lib/ffaker/nato_alphabet.rb, line 27
def codify(masks)
  masks.scan(/./).map do |c|
    case c
    when '#' then fetch_sample(NUMERIC_CODES)
    when '?' then fetch_sample(ALPHABET_CODES)
    when '.' then STOP_CODE
    else c
    end
  end.join
end
numeric_code() click to toggle source
# File lib/ffaker/nato_alphabet.rb, line 19
def numeric_code
  fetch_sample(NUMERIC_CODES)
end