Class: LicenseFinder::Dotnet::PackageMetadata

Inherits:
Object
  • Object
show all
Defined in:
lib/license_finder/package_managers/dotnet.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, version, possible_spec_paths) ⇒ PackageMetadata

Returns a new instance of PackageMetadata.



38
39
40
41
42
# File 'lib/license_finder/package_managers/dotnet.rb', line 38

def initialize(name, version, possible_spec_paths)
  @name = name
  @version = version
  @possible_spec_paths = possible_spec_paths
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



36
37
38
# File 'lib/license_finder/package_managers/dotnet.rb', line 36

def name
  @name
end

#possible_spec_pathsObject (readonly)

Returns the value of attribute possible_spec_paths.



36
37
38
# File 'lib/license_finder/package_managers/dotnet.rb', line 36

def possible_spec_paths
  @possible_spec_paths
end

#versionObject (readonly)

Returns the value of attribute version.



36
37
38
# File 'lib/license_finder/package_managers/dotnet.rb', line 36

def version
  @version
end

Instance Method Details

#==(other) ⇒ Object



50
51
52
# File 'lib/license_finder/package_managers/dotnet.rb', line 50

def ==(other)
  other.name == name && other.version == version && other.possible_spec_paths == possible_spec_paths
end

#read_license_urlsObject



44
45
46
47
48
# File 'lib/license_finder/package_managers/dotnet.rb', line 44

def read_license_urls
  possible_spec_paths.flat_map do |path|
    Nuget.nuspec_license_urls(File.read(path)) if File.exist? path
  end.compact
end