Module: IERS::Parsers::Finals

Defined in:
lib/iers/parsers/finals.rb

Defined Under Namespace

Classes: Entry

Constant Summary collapse

MJD_Y2K_PIVOT =
51544.0

Class Method Summary collapse

Class Method Details

.parse(path) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/iers/parsers/finals.rb', line 22

def parse(path)
  path = Pathname(path)

  unless path.exist?
    raise FileNotFoundError.new(
      "File not found: #{path}",
      path: path.to_s
    )
  end

  entries = []

  path.each_line.with_index(1) do |line, line_number|
    next if line.strip.empty?
    next if no_eop_data?(line)

    entries << parse_line(line, path, line_number)
  end

  entries.freeze
end