lib/inspec/dependencies/requirement.rb in inspec-4.3.2 vs lib/inspec/dependencies/requirement.rb in inspec-4.6.3
- old
+ new
@@ -1,17 +1,16 @@
-# encoding: utf-8
-require 'inspec/cached_fetcher'
-require 'semverse'
+require "inspec/cached_fetcher"
+require "semverse"
module Inspec
#
# Inspec::Requirement represents a given profile dependency, where
# appropriate we delegate to Inspec::Profile directly.
#
class Requirement
def self.from_metadata(dep, cache, opts)
- raise 'Cannot load empty dependency.' if dep.nil? || dep.empty?
+ raise "Cannot load empty dependency." if dep.nil? || dep.empty?
req_path = opts[:cwd]
if dep[:path]
req_path = File.expand_path(dep[:path], req_path)
@@ -80,16 +79,16 @@
@resolved_source ||= fetcher.resolved_source
end
def to_hash
h = {
- 'name' => name,
- 'resolved_source' => resolved_source,
- 'version_constraints' => version_constraints,
+ "name" => name,
+ "resolved_source" => resolved_source,
+ "version_constraints" => version_constraints,
}
if !dependencies.empty?
- h['dependencies'] = dependencies.map(&:to_hash)
+ h["dependencies"] = dependencies.map(&:to_hash)
end
h
end