Class: LatestInSpecVersion
- Inherits:
- 
      Object
      
        - Object
- LatestInSpecVersion
 
- Defined in:
- lib/utils/latest_version.rb
Instance Method Summary collapse
- 
  
    
      #latest  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    fetches the latest version from rubygems server. 
Instance Method Details
#latest ⇒ Object
fetches the latest version from rubygems server
| 9 10 11 12 13 14 15 16 17 18 19 20 21 | # File 'lib/utils/latest_version.rb', line 9 def latest uri = URI('https://rubygems.org/api/v1/gems/inspec.json') res = Net::HTTP.start( uri.host, uri.port, use_ssl: uri.scheme == 'https', open_timeout: 0.5, read_timeout: 0.5 ) { |http| http.get(uri.path) } inspec_info = JSON.parse(res.body) inspec_info['version'] rescue StandardError nil end |