Sha256: 55a7b472785efba6faaaf53a8e6f9a12ab107993cacca4d964e4ab9ac11fedf1
Contents?: true
Size: 941 Bytes
Versions: 24
Compression:
Stored size: 941 Bytes
Contents
# frozen_string_literal: true module Faker class FunnyName < Base flexible :funny_name class << self def name fetch('funny_name.name') end def two_word_name two_word_names = fetch_all('funny_name.name').select do |name| name.count(' ') == 1 end sample(two_word_names) end def three_word_name three_word_names = fetch_all('funny_name.name').select do |name| name.count(' ') == 2 end sample(three_word_names) end def four_word_name four_word_names = fetch_all('funny_name.name').select do |name| name.count(' ') == 3 end sample(four_word_names) end def name_with_initial names_with_initials = fetch_all('funny_name.name').select do |name| name.count('.').positive? end sample(names_with_initials) end end end end
Version data entries
24 entries across 24 versions & 1 rubygems