Sha256: f2b4736821fa38f10669f75c00bb569e1f8a3b61cfb9a7249e966c520a57a6ac
Contents?: true
Size: 732 Bytes
Versions: 7
Compression:
Stored size: 732 Bytes
Contents
module Neovim # Object representing the `nvim` executable. class Executable VERSION_PATTERN = /\ANVIM v?(.+)$/ class Error < RuntimeError; end # Load the current executable from the +NVIM_EXECUTABLE+ environment # variable. # # @param env [Hash] # @return [Executable] def self.from_env(env=ENV) new(env.fetch("NVIM_EXECUTABLE", "nvim")) end attr_reader :path def initialize(path) @path = path end # Fetch the +nvim+ version. # # @return [String] def version @version ||= IO.popen([@path, "--version"]) do |io| io.gets[VERSION_PATTERN, 1] end rescue => e raise Error, "Couldn't load #{@path}: #{e}" end end end
Version data entries
7 entries across 7 versions & 1 rubygems