class Mocker::Name

Public Class Methods

famous_person() click to toggle source
# File lib/mocker/name.rb, line 4
def famous_person
  I18n.t("names.famous_people").sample
end
first_name(gender=nil) click to toggle source
# File lib/mocker/name.rb, line 12
def first_name gender=nil
  translation="names.first"
  translation+=".#{gender}" if !gender.nil?

  all_first = I18n.t translation
  all_first = all_first.values.flatten if all_first.is_a?(Hash)
  all_first.sample
end
full_name(gender=nil) click to toggle source
# File lib/mocker/name.rb, line 8
def full_name gender=nil
  "#{first_name gender} #{last_name}"
end
last_name() click to toggle source
# File lib/mocker/name.rb, line 21
def last_name
  I18n.t("names.last").sample
end