Sha256: aba9b2ba9af96a473ebca1c454bf7c094dafdfccf28921ec1c30bd1ba1254d1a

Contents?: true

Size: 419 Bytes

Versions: 1

Compression:

Stored size: 419 Bytes

Contents

module AsdfDiscover
  module Searchers
    # Searches for a Ruby version in a Gemfile
    class Gemfile
      GEMFILE = "Gemfile".freeze

      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
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
asdf-discover-1.0.0 lib/asdf_discover/searchers/gemfile.rb