Module: LatestVersion
- Defined in:
- lib/latest_version.rb,
lib/latest_version/cli.rb,
lib/latest_version/version.rb,
lib/latest_version/completion.rb
Defined Under Namespace
Modules: Completion
Classes: CLI
Constant Summary
collapse
- UnknownLibraryError =
Class.new(StandardError)
- VERSION =
'0.1.5'
Class Method Summary
collapse
Class Method Details
.of(library) ⇒ Object
23
24
25
|
# File 'lib/latest_version.rb', line 23
def self.of(library)
LIBRARIES.fetch(library.to_sym) { raise UnknownLibraryError, library }.call
end
|
.of_rubygem(gem_name) ⇒ Object
27
28
29
30
|
# File 'lib/latest_version.rb', line 27
def self.of_rubygem(gem_name)
json = Net::HTTP.get(URI("https://rubygems.org/api/v1/versions/#{gem_name}/latest.json"))
JSON.parse(json, symbolize_names: true).fetch(:version)
end
|
.supported_libraries ⇒ Object
32
33
34
|
# File 'lib/latest_version.rb', line 32
def self.supported_libraries
LIBRARIES.keys.sort
end
|