Class: Hrw::Scanner::Pipfile
- Inherits:
-
Object
- Object
- Hrw::Scanner::Pipfile
- Defined in:
- lib/hrw/scanner/pipfile.rb
Overview
Used to scan gem lock file
Instance Attribute Summary collapse
-
#package_manager ⇒ Object
readonly
Returns the value of attribute package_manager.
Instance Method Summary collapse
-
#initialize(root = Dir.pwd, lockfile = 'Pipfile.lock') ⇒ Pipfile
constructor
Class constructor.
-
#scan ⇒ Hash
Scan the lock file.
Constructor Details
Instance Attribute Details
#package_manager ⇒ Object (readonly)
Returns the value of attribute package_manager.
9 10 11 |
# File 'lib/hrw/scanner/pipfile.rb', line 9 def package_manager @package_manager end |
Instance Method Details
#scan ⇒ Hash
Scan the lock file
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/hrw/scanner/pipfile.rb', line 24 def scan deps = [] lock = JSON.parse(File.read(File.join(@root, @lockfile))) lock['default'].each_pair do |name, info| next if info['version'].nil? deps << { name: name, version: info['version'].delete_prefix('==') } end deps end |