Class: JRuby::Lint::Libraries::CExtensions

Inherits:
Object
  • Object
show all
Defined in:
lib/jruby/lint/libraries.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cache) ⇒ CExtensions

Returns a new instance of CExtensions.



69
70
71
# File 'lib/jruby/lint/libraries.rb', line 69

def initialize(cache)
  @cache = cache
end

Instance Attribute Details

#gemsObject (readonly)

Returns the value of attribute gems.



67
68
69
# File 'lib/jruby/lint/libraries.rb', line 67

def gems
  @gems
end

Instance Method Details

#loadObject



73
74
75
76
77
78
79
80
81
82
83
# File 'lib/jruby/lint/libraries.rb', line 73

def load
  @gems = {}
  content = @cache.fetch('C-Extension-Alternatives')
  doc = Nokogiri::HTML(content)
  doc.css('#wiki-body ul li').each do |li|
    key, message = li.text.split(/[ -]+/, 2)
    @gems[key.downcase] = message
  end
rescue => e
  @error = "Unable to load C Extension alternatives list: #{e.message}"
end