class AsdfDiscover::Searchers::Gemfile

Searches for a Ruby version in a Gemfile

Constants

GEMFILE

Public Instance Methods

call() click to toggle source
# File lib/asdf_discover/searchers/gemfile.rb, line 7
def call
  return NotFound unless File.exist?(GEMFILE)

  File.open(GEMFILE, "r").each_line do |line|
    return Found.new("ruby", Regexp.last_match(1), GEMFILE) if line =~ /ruby ['"]([0-9.]+)['"]$/
  end

  NotFound
end