class JRuby::Lint::Libraries::CExtensions

Attributes

gems[R]

Public Class Methods

new(cache) click to toggle source
# File lib/jruby/lint/libraries.rb, line 50
def initialize(cache)
  @cache = cache
end

Public Instance Methods

load() click to toggle source
# File lib/jruby/lint/libraries.rb, line 54
def load
  @gems = {}
  content = @cache.fetch('C-Extension-Alternatives.md')

  in_suggestions = false
  content.split("\n").each do |line|
    if line =~ /<!-- suggestions start/
      in_suggestions = true
    elsif !in_suggestions
      next
    elsif line =~ /<!-- suggestions end/
      in_suggestions = false
      break
    else
      _, key, value = line.gsub(/[\[\]]/, '').split("|", 3)
      @gems[key.downcase] = value
    end
  end
rescue => e
  @error = "Unable to load C Extension alternatives list: #{e.message}"
end