Class: Astronoby::Constellations::Data

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

Class Method Summary collapse

Class Method Details

.constellation_namesObject



28
29
30
31
# File 'lib/astronoby/constellations/data.rb', line 28

def self.constellation_names
  @constellation_names ||=
    read_file("constellation_names.dat").map(&:split)
end

.data_path(filename) ⇒ Object



37
38
39
# File 'lib/astronoby/constellations/data.rb', line 37

def self.data_path(filename)
  File.join(__dir__, "..", "data", "constellations", filename)
end

.indexed_abbreviationsObject



23
24
25
26
# File 'lib/astronoby/constellations/data.rb', line 23

def self.indexed_abbreviations
  @indexed_abbreviations ||=
    read_file("indexed_abbreviations.dat")
end

.radec_to_indexObject



16
17
18
19
20
21
# File 'lib/astronoby/constellations/data.rb', line 16

def self.radec_to_index
  @radec_to_index ||=
    read_file("radec_to_index.dat").map do |line|
      line.split.map(&:to_i)
    end
end

.read_file(filename) ⇒ Object



33
34
35
# File 'lib/astronoby/constellations/data.rb', line 33

def self.read_file(filename)
  File.readlines(data_path(filename)).map(&:strip)
end

.sorted_declinationsObject



11
12
13
14
# File 'lib/astronoby/constellations/data.rb', line 11

def self.sorted_declinations
  @sorted_declinations ||=
    read_file("sorted_declinations.dat").map(&:to_f)
end

.sorted_right_ascensionsObject



6
7
8
9
# File 'lib/astronoby/constellations/data.rb', line 6

def self.sorted_right_ascensions
  @sorted_right_ascensions ||=
    read_file("sorted_right_ascensions.dat").map(&:to_f)
end