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

Version Path
faker-2.10.2 lib/faker/default/funny_name.rb
faker-2.10.1 lib/faker/default/funny_name.rb
faker-2.10.0 lib/faker/default/funny_name.rb
faker-2.9.0 lib/faker/default/funny_name.rb
faker-2.8.1 lib/faker/default/funny_name.rb
faker-2.8.0 lib/faker/default/funny_name.rb
faker-2.7.0 lib/faker/default/funny_name.rb
faker-2.6.0 lib/faker/default/funny_name.rb
faker-2.5.0 lib/faker/default/funny_name.rb
faker-2.4.0 lib/faker/default/funny_name.rb
faker-2.3.0 lib/faker/default/funny_name.rb
faker-2.2.2 lib/faker/default/funny_name.rb
faker-2.2.1 lib/faker/default/funny_name.rb
faker-2.2.0 lib/faker/default/funny_name.rb
faker-2.1.2 lib/faker/default/funny_name.rb
faker-2.1.1 lib/faker/default/funny_name.rb
faker-2.1.0 lib/faker/default/funny_name.rb
faker-2.0.0 lib/faker/default/funny_name.rb
faker-2.0 lib/faker/default/funny_name.rb
faker-1.9.6 lib/faker/default/funny_name.rb