module FFaker::NameCS
def with_same_sex(sex = :random)
person.last_name # => "Nováková"
end
person.first_name = FFaker::NameCS.first_name
person.last_name = FFaker::NameCS.last_name
FFaker::NameCS.with_same_sex(:female)
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(0..1)] : sex yield ensure @fixed_sex = nil end