Class: Faker::FunnyName

Inherits:
Base
  • Object
show all
Defined in:
lib/faker/funny_name.rb

Constant Summary

Constants inherited from Base

Base::Letters, Base::Numbers, Base::ULetters

Class Method Summary collapse

Methods inherited from Base

bothify, fetch, fetch_all, flexible, letterify, method_missing, numerify, parse, rand, rand_in_range, regexify, sample, shuffle, translate, unique, with_locale

Class Method Details

.four_word_nameObject


26
27
28
29
30
31
32
# File 'lib/faker/funny_name.rb', line 26

def four_word_name
  four_word_names = fetch_all('funny_name.name').select do |name|
    name.count(' ') == 3
  end

  sample(four_word_names)
end

.nameObject


6
7
8
# File 'lib/faker/funny_name.rb', line 6

def name
  fetch('funny_name.name')
end

.name_with_initialObject


34
35
36
37
38
39
40
# File 'lib/faker/funny_name.rb', line 34

def name_with_initial
  names_with_initials = fetch_all('funny_name.name').select do |name|
    name.count('.') > 0
  end

  sample(names_with_initials)
end

.three_word_nameObject


18
19
20
21
22
23
24
# File 'lib/faker/funny_name.rb', line 18

def three_word_name
  three_word_names = fetch_all('funny_name.name').select do |name|
    name.count(' ') == 2
  end

  sample(three_word_names)
end

.two_word_nameObject


10
11
12
13
14
15
16
# File 'lib/faker/funny_name.rb', line 10

def two_word_name
  two_word_names = fetch_all('funny_name.name').select do |name|
    name.count(' ') == 1
  end

  sample(two_word_names)
end