module Faker::NameRU
def with_same_sex(sex = :random)
person.first_name # => "Александр"
person.last_name # => "Иванов"
end
person.patronymic = Faker::NameRU.patronymic
person.first_name = Faker::NameRU.first_name
person.last_name = Faker::NameRU.last_name
Faker::NameRU.with_same_sex(:male)
all calls inside thee block:
Can be called with explicit sex which will affect
All names generated inside the block will have the same sex.
def with_same_sex(sex = :random) @fixed_sex = sex == :random ? GENDERS[rand(2)] : sex yield ensure @fixed_sex = nil end