Class: Astronoby::Constellations::Repository

Inherits:
Object
  • Object
show all
Defined in:
lib/astronoby/constellations/repository.rb

Class Method Summary collapse

Class Method Details

.get(abbreviation) ⇒ Astronoby::Constellation?

Returns a constellation object for the given abbreviation.

Parameters:

  • abbreviation (String)

    The abbreviation of the constellation.

Returns:



10
11
12
13
14
15
16
17
# File 'lib/astronoby/constellations/repository.rb', line 10

def self.get(abbreviation)
  @constellations ||= Data.constellation_names.map do |abbr, name|
    constellation = Constellation.new(name, abbr)
    [abbr, constellation]
  end.to_h

  @constellations[abbreviation]
end