Top Level Namespace

Defined Under Namespace

Modules: Crazipsum

Constant Summary collapse

DEFAULT_FILLERS =
File.read(File.join(data_dir, 'fillers.txt')).split("\n")

Instance Method Summary collapse

Instance Method Details

#Crazipsum(type) ⇒ Crazipsum::Generator

Returns a lorem ipsum generator which will generate lorem ipsums of the given type.

There are a few default types registered:

  • ‘car_make`

  • ‘phobia`

  • ‘programming_language`

  • ‘animal`

  • ‘fruit`

  • ‘constellation`

  • ‘mineral`

  • ‘religion`

  • ‘country`

You can register new types of lorem ipsum via ‘Crazipsum.register(type, words, fillers: fillers)`.

Parameters:

  • type (Symbol, String)

    the type of lorem ipsum you’d like to generate.

Returns:

Raises:

  • (ArgumentError)


42
43
44
45
46
47
# File 'lib/crazipsum.rb', line 42

def Crazipsum(type) # rubocop:disable Naming/MethodName
  dictionnary = Crazipsum::Registry.instance[type]
  raise ArgumentError, 'unregistered ipsum type' if dictionnary.nil?

  Crazipsum::Generator.new(dictionnary)
end