Module: EndOfLife::Parsers::ToolVersions

Extended by:
ToolVersions
Included in:
ToolVersions
Defined in:
lib/end_of_life/parsers/tool_versions.rb

Instance Method Summary collapse

Instance Method Details

#parse(file_content) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/end_of_life/parsers/tool_versions.rb', line 6

def parse(file_content)
  file_content
    .lines
    .filter_map { |line|
      line = line.strip
      next if line.start_with?("#") || line.empty?

      tool, version, * = line.split

      next if version == "latest"

      [tool, Gem::Version.new(version)]
    }
    .to_h
end