Class: LicenseFinder::MergedPackage

Inherits:
Package
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/license_finder/packages/merged_package.rb

Instance Attribute Summary collapse

Attributes inherited from Package

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

Instance Method Summary collapse

Methods inherited from Package

#activations, #approved?, #approved_manually!, #approved_manually?, #decide_on_license, #hash, #license_files, license_names_from_standard_spec, #licenses, #licenses_from_spec, #licensing, #log_activation, #missing?, #notice_files, #package_manager, #permitted!, #permitted?, #restricted!, #restricted?

Constructor Details

#initialize(package, aggregate_paths) ⇒ MergedPackage

Returns a new instance of MergedPackage.



8
9
10
11
12
# File 'lib/license_finder/packages/merged_package.rb', line 8

def initialize(package, aggregate_paths)
  @dependency = package
  @aggregate_paths = aggregate_paths.map { |p| Pathname(p) }
  super(package.name, package.version)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(_method_name) ⇒ Object



40
41
42
# File 'lib/license_finder/packages/merged_package.rb', line 40

def method_missing(_method_name)
  nil
end

Instance Attribute Details

#dependencyObject (readonly)

Returns the value of attribute dependency.



6
7
8
# File 'lib/license_finder/packages/merged_package.rb', line 6

def dependency
  @dependency
end

Instance Method Details

#<=>(other) ⇒ Object



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

def <=>(other)
  dependency <=> other.dependency
end

#==(other) ⇒ Object



36
37
38
# File 'lib/license_finder/packages/merged_package.rb', line 36

def ==(other)
  dependency.eql?(other.dependency) && aggregate_paths.eql?(other.aggregate_paths)
end

#aggregate_pathsObject



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

def aggregate_paths
  @aggregate_paths.map { |p| p.expand_path.to_s }
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
31
32
33
34
# File 'lib/license_finder/packages/merged_package.rb', line 28

def eql?(other)
  if other.instance_of? MergedPackage
    other.dependency.eql?(dependency)
  else
    dependency.eql?(other)
  end
end