Sha256: 6b6840f992011e0dcf288bba72a886c106305e93b92ace747e74a6dfc45d7764

Contents?: true

Size: 444 Bytes

Versions: 2

Compression:

Stored size: 444 Bytes

Contents

module RailsFinder
  class IsolateFile
    attr_reader :path

    def initialize(path)
      @path = path
    end

    def exists?
      File.exists?(path)
    end

    def rails_version
      return @rails_version if @rails_version
      line = File.readlines(path).find { |l| l =~ /^gem.+rails/i }
      if line
        @rails_version = line[/\d+\.\d+(\.\d+)?/] || "n/a"
      else
        @rails_version = "n/a"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails_finder-0.0.3 lib/rails_finder/isolate_file.rb
rails_finder-0.0.2 lib/rails_finder/isolate_file.rb