Module: Fucker::Name

Defined in:
lib/mealib/fucker/name/name.rb

Instance Method Summary collapse

Instance Method Details

#_fuck(filename) ⇒ Object

noinspection RubyNilAnalysis



16
17
18
19
20
21
22
23
24
25
# File 'lib/mealib/fucker/name/name.rb', line 16

def _fuck(filename)
  file        = File.expand_path('%s.txt' % filename, File.dirname(__FILE__))
  chosen_line = nil

  File.foreach(file).each_with_index do |line, number|
    chosen_line = line if rand < 1.0/(number+1)
  end

  chosen_line.split("\n").join
end

#make_first_name(lang: :ru, sex: :man) ⇒ Object



3
4
5
# File 'lib/mealib/fucker/name/name.rb', line 3

def make_first_name(lang: :ru, sex: :man)
  _fuck 'first_name_%s_%s' % [lang, sex]
end

#make_last_name(lang: :ru, sex: :man) ⇒ Object



7
8
9
# File 'lib/mealib/fucker/name/name.rb', line 7

def make_last_name(lang: :ru, sex: :man)
  _fuck 'last_name_%s_%s' % [lang, sex]
end

#make_sur_name(lang: :ru, sex: :man) ⇒ Object



11
12
13
# File 'lib/mealib/fucker/name/name.rb', line 11

def make_sur_name(lang: :ru, sex: :man)
  _fuck 'sur_name_%s_%s' % [lang, sex]
end