Sha256: 4ca48c969ba7ffc1f7b1e07cae12d336350df5cbf8616d8c06335132076f78c3

Contents?: true

Size: 1.36 KB

Versions: 14

Compression:

Stored size: 1.36 KB

Contents

# frozen_string_literal: true

module LicenseFinder
  class MergedPackage < Package
    extend Forwardable
    attr_reader :dependency

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

    def_delegators :@dependency, :name, :version, :authors, :summary, :description, :homepage, :children, :parents,
                   :groups, :whitelisted, :blacklisted, :manual_approval, :install_path, :licenses, :approved_manually?,
                   :approved_manually!, :approved?, :whitelisted!, :whitelisted?, :blacklisted!, :blacklisted?, :hash,
                   :activations, :missing, :license_names_from_spec, :decided_licenses, :licensing, :decide_on_license,
                   :license_files, :package_manager, :missing?, :log_activation, :notice_files

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

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

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

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

    def method_missing(_method_name)
      nil
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
license_finder-5.11.1 lib/license_finder/packages/merged_package.rb
license_finder-5.11.0 lib/license_finder/packages/merged_package.rb
license_finder-5.10.2 lib/license_finder/packages/merged_package.rb
license_finder-5.10.1 lib/license_finder/packages/merged_package.rb
license_finder-5.10.0 lib/license_finder/packages/merged_package.rb
license_finder-5.9.2 lib/license_finder/packages/merged_package.rb
license_finder-5.9.1 lib/license_finder/packages/merged_package.rb
license_finder-5.9.0 lib/license_finder/packages/merged_package.rb
license_finder-5.8.0 lib/license_finder/packages/merged_package.rb
license_finder-5.7.1 lib/license_finder/packages/merged_package.rb
license_finder-5.7.0 lib/license_finder/packages/merged_package.rb
license_finder-5.6.2 lib/license_finder/packages/merged_package.rb
license_finder-5.6.1 lib/license_finder/packages/merged_package.rb
license_finder-5.6.0 lib/license_finder/packages/merged_package.rb