Class: LicenseFinder::Nuget::Assembly

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, name) ⇒ Assembly

Returns a new instance of Assembly.



11
12
13
14
# File 'lib/license_finder/package_managers/nuget.rb', line 11

def initialize(path, name)
  @path = path
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



9
10
11
# File 'lib/license_finder/package_managers/nuget.rb', line 9

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path.



9
10
11
# File 'lib/license_finder/package_managers/nuget.rb', line 9

def path
  @path
end

Instance Method Details

#dependenciesObject



16
17
18
19
20
21
22
23
# File 'lib/license_finder/package_managers/nuget.rb', line 16

def dependencies
  xml = REXML::Document.new(File.read(path.join('packages.config')))
  packages = REXML::XPath.match(xml, '//package')
  packages.map do |p|
    attrs = p.attributes
    Dependency.new(attrs['id'], attrs['version'], name)
  end
end