Class: Cliver::Dependency

Inherits:
Object
  • Object
show all
Defined in:
lib/cliver/dependency_ext.rb

Instance Method Summary collapse

Instance Method Details

#major_versionObject



20
21
22
# File 'lib/cliver/dependency_ext.rb', line 20

def major_version
  version&.split('.')&.first
end

#pathObject

Memoized shortcut for detect Returns the path to the detected dependency Raises an error if the dependency was not satisfied



8
9
10
# File 'lib/cliver/dependency_ext.rb', line 8

def path
  @path ||= detect!
end

#versionObject

Returns the version of the resolved dependency



13
14
15
16
17
18
# File 'lib/cliver/dependency_ext.rb', line 13

def version
  return @version if defined? @version

  version = installed_versions.find { |p, _v| p == path }
  @detected_version = version.nil? ? nil : version[1]
end