File: cheesy_lingo.rb

package info (click to toggle)
ruby-ffaker 2.23.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,776 kB
  • sloc: ruby: 12,788; makefile: 8; sh: 1
file content (39 lines) | stat: -rw-r--r-- 962 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# frozen_string_literal: true

module FFaker
  module CheesyLingo
    # Born during RailsGirls Summer of Code 2015. Team Cheesy says Hi!

    extend ModuleUtils
    extend self

    TITLE_1 = %w[Sharp Soft Nutty Smokey Melting Cheeky Fat Dutch Grated Cheesed Milky].freeze
    TITLE_2 = %w[Gouda Affineurs Alpine Sheep Cows Brie Goats Coulommiers Dairy].freeze

    def title
      "#{fetch_sample(TITLE_1)} #{fetch_sample(TITLE_2)}"
    end

    def word
      fetch_sample(CHEESY_WORDS)
    end

    def words(count = 5)
      fetch_sample(CHEESY_WORDS, count: count)
    end

    def sentence
      "#{[
        fetch_sample(CHEESY_PHRASES).capitalize,
        fetch_sample(CHEESY_PHRASES),
        fetch_sample(CHEESY_PHRASES)
      ].join}."
    end

    def paragraph(number_of_phrases = 10)
      p = +fetch_sample(CHEESY_PHRASES).capitalize
      (number_of_phrases - 1).times { p << " #{fetch_sample(CHEESY_PHRASES)}" }
      p << '.'
    end
  end
end