Sha256: 5d310b9894ff3ac98e6e5812476e2549ee1623200ec796fcb2478295a8e889ed

Contents?: true

Size: 1.7 KB

Versions: 33

Compression:

Stored size: 1.7 KB

Contents

# frozen_string_literal: true

module Faker
  class Coffee < Base
    flexible :coffee

    class << self
      ##
      # Produces a random blend name.
      #
      # @return [String]
      #
      # @example
      #   Faker::Coffee.blend_name #=> "Major Java"
      #
      # @faker.version 1.9.0
      def blend_name
        parse('coffee.blend_name')
      end

      ##
      # Produces a random coffee origin place.
      #
      # @return [String]
      #
      # @example
      #   Faker::Coffee.origin #=> "Oaxaca, Mexico"
      #
      # @faker.version 1.9.0
      def origin
        country = fetch('coffee.country')
        region = fetch("coffee.regions.#{search_format(country)}")
        "#{region}, #{country}"
      end

      ##
      # Produces a random coffee variety.
      #
      # @return [String]
      #
      # @example
      #   Faker::Coffee.variety #=> "Red Bourbon"
      #
      # @faker.version 1.9.0
      def variety
        fetch('coffee.variety')
      end

      ##
      # Produces a string containing a random description of a coffee's taste.
      #
      # @return [String]
      #
      # @example
      #   Faker::Coffee.notes #=> "dull, tea-like, cantaloupe, soy sauce, marshmallow"
      #
      # @faker.version 1.9.0
      def notes
        parse('coffee.notes')
      end

      ##
      # Produces a random coffee taste intensity.
      #
      # @return [String]
      #
      # @example
      #   Faker::Coffee.intensifier #=> "mild"
      #
      # @faker.version 1.9.0
      def intensifier
        fetch('coffee.intensifier')
      end

      private

      def search_format(key)
        key.split.length > 1 ? key.split.join('_').downcase : key.downcase
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 2 rubygems

Version Path
faker-3.5.1 lib/faker/default/coffee.rb
faker-3.4.2 lib/faker/default/coffee.rb
faker-3.4.1 lib/faker/default/coffee.rb
faker-3.3.1 lib/faker/default/coffee.rb
faker-3.3.0 lib/faker/default/coffee.rb
faker-3.2.3 lib/faker/default/coffee.rb
faker-3.2.2 lib/faker/default/coffee.rb
faker-3.2.1 lib/faker/default/coffee.rb
faker-3.2.0 lib/faker/default/coffee.rb
faker-3.1.1 lib/faker/default/coffee.rb
faker-3.1.0 lib/faker/default/coffee.rb
faker-3.0.0 lib/faker/default/coffee.rb
faker-2.23.0 lib/faker/default/coffee.rb
faker-2.22.0 lib/faker/default/coffee.rb
faker-2.21.0 lib/faker/default/coffee.rb
faker-2.20.0 lib/faker/default/coffee.rb
faker-2.19.0 lib/faker/default/coffee.rb
logstash-output-scalyr-0.1.7 vendor/bundle/jruby/2.5.0/bundler/gems/faker-e1bd4a5a5777/lib/faker/default/coffee.rb
faker-2.18.0 lib/faker/default/coffee.rb
faker-2.17.0 lib/faker/default/coffee.rb