Class: JRuby::Lint::Libraries::CExtensions
- Inherits:
-
Object
- Object
- JRuby::Lint::Libraries::CExtensions
- Defined in:
- lib/jruby/lint/libraries.rb
Instance Attribute Summary collapse
-
#gems ⇒ Object
readonly
Returns the value of attribute gems.
Instance Method Summary collapse
-
#initialize(cache) ⇒ CExtensions
constructor
A new instance of CExtensions.
- #load ⇒ Object
Constructor Details
#initialize(cache) ⇒ CExtensions
Returns a new instance of CExtensions.
50 51 52 |
# File 'lib/jruby/lint/libraries.rb', line 50 def initialize(cache) @cache = cache end |
Instance Attribute Details
#gems ⇒ Object (readonly)
Returns the value of attribute gems.
48 49 50 |
# File 'lib/jruby/lint/libraries.rb', line 48 def gems @gems end |
Instance Method Details
#load ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# 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.}" end |