Class: LicenseFinder::CondaPackage

Inherits:
Package
  • Object
show all
Defined in:
lib/license_finder/packages/conda_package.rb

Defined Under Namespace

Classes: Identifier

Instance Attribute Summary collapse

Attributes inherited from Package

#authors, #description, #groups, #homepage, #install_path, #license_names_from_spec, #logger, #manual_approval, #name, #parents, #summary, #version

Instance Method Summary collapse

Methods inherited from Package

#<=>, #activations, #approved?, #approved_manually!, #approved_manually?, #decide_on_license, #eql?, #hash, #license_files, license_names_from_standard_spec, #licenses, #licenses_from_spec, #licensing, #log_activation, #missing?, #notice_files, #permitted!, #permitted?, #restricted!, #restricted?

Constructor Details

#initialize(conda_json) ⇒ CondaPackage

Returns a new instance of CondaPackage.



7
8
9
10
11
12
13
14
# File 'lib/license_finder/packages/conda_package.rb', line 7

def initialize(conda_json)
  @json = conda_json
  @identifier = Identifier.from_hash(conda_json)
  super(@identifier.name,
        @identifier.version,
        spec_licenses: Package.license_names_from_standard_spec(conda_json),
        children: children)
end

Instance Attribute Details

#identifierObject

Returns the value of attribute identifier.



5
6
7
# File 'lib/license_finder/packages/conda_package.rb', line 5

def identifier
  @identifier
end

#jsonObject

Returns the value of attribute json.



5
6
7
# File 'lib/license_finder/packages/conda_package.rb', line 5

def json
  @json
end

Instance Method Details

#==(other) ⇒ Object



16
17
18
# File 'lib/license_finder/packages/conda_package.rb', line 16

def ==(other)
  other.is_a?(CondaPackage) && @identifier == other.identifier
end

#childrenObject



32
33
34
# File 'lib/license_finder/packages/conda_package.rb', line 32

def children
  @json.fetch('depends', []).map { |constraint| constraint.split.first }
end

#package_managerObject



24
25
26
# File 'lib/license_finder/packages/conda_package.rb', line 24

def package_manager
  'Conda'
end

#package_urlObject



28
29
30
# File 'lib/license_finder/packages/conda_package.rb', line 28

def package_url
  @json['url']
end

#to_sObject



20
21
22
# File 'lib/license_finder/packages/conda_package.rb', line 20

def to_s
  @identifier.to_s
end