Class: Faussaire::Cosmos

Inherits:
Object
  • Object
show all
Defined in:
lib/faussaire/cosmos.rb

Constant Summary collapse

DATA_PATH =
File.expand_path('../../locale/fr.yml', __dir__)

Class Method Summary collapse

Class Method Details

.eventString

Produces a random cosmic event.

Examples:

Faussaire::Cosmos.event #=> "Éclipse solaire"

Returns:

  • (String)


32
33
34
# File 'lib/faussaire/cosmos.rb', line 32

def event
  fetch('fr.faussaire.cosmos.event')
end

.explorationString

Produces a random space exploration name.

Examples:

Faussaire::Cosmos.exploration #=> "Voyager"

Returns:

  • (String)


56
57
58
# File 'lib/faussaire/cosmos.rb', line 56

def exploration
  fetch('fr.faussaire.cosmos.exploration')
end

.initialize_dataObject



8
9
10
# File 'lib/faussaire/cosmos.rb', line 8

def initialize_data
  @data = YAML.load_file(DATA_PATH)
end

.neighborhoodString

Produces a random neighborhood in the cosmos (like a galaxy or nebula).

Examples:

Faussaire::Cosmos.neighborhood #=> "Voie lactée"

Returns:

  • (String)


44
45
46
# File 'lib/faussaire/cosmos.rb', line 44

def neighborhood
  fetch('fr.faussaire.cosmos.neighborhood')
end

.planetString

Produces a random planet name.

Examples:

Faussaire::Cosmos.planet #=> "Mars"

Returns:

  • (String)


20
21
22
# File 'lib/faussaire/cosmos.rb', line 20

def planet
  fetch('fr.faussaire.cosmos.planet')
end