Class: Y2Packager::LicensesFetchers::Base

Inherits:
Object
  • Object
show all
Includes:
Yast::Logger
Defined in:
library/packages/src/lib/y2packager/licenses_fetchers/base.rb

Overview

Base class for licenses fetchers

Direct Known Subclasses

Archive, Libzypp

Constant Summary collapse

DEFAULT_LANG =
"en_US".freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(product_name, _options = {}) ⇒ Base

Constructor



31
32
33
# File 'library/packages/src/lib/y2packager/licenses_fetchers/base.rb', line 31

def initialize(product_name, _options = {})
  @product_name = product_name
end

Instance Attribute Details

#product_nameString (readonly)



26
27
28
# File 'library/packages/src/lib/y2packager/licenses_fetchers/base.rb', line 26

def product_name
  @product_name
end

Instance Method Details

#confirmation_required?Boolean

Determine whether the license should be accepted or not



66
67
68
# File 'library/packages/src/lib/y2packager/licenses_fetchers/base.rb', line 66

def confirmation_required?
  true
end

#content(lang) ⇒ String?

Return the license content



47
48
49
50
51
52
53
54
# File 'library/packages/src/lib/y2packager/licenses_fetchers/base.rb', line 47

def content(lang)
  # FIXME: not #default_content at some place?
  if default_lang?(lang) && @default_content
    return @default_content&.empty? ? nil : @default_content
  end

  license_content_for(lang)
end

#found?Booelan

Check if this is a valid fecher based on the existence of license content for default language



38
39
40
# File 'library/packages/src/lib/y2packager/licenses_fetchers/base.rb', line 38

def found?
  !default_content.empty?
end

#localesArray<String>

Return available language codes for the license of the product



59
60
61
# File 'library/packages/src/lib/y2packager/licenses_fetchers/base.rb', line 59

def locales
  []
end