Module: Y2Packager::ProductLicenseMixin
- Included in:
- Product
- Defined in:
- library/packages/src/lib/y2packager/product_license_mixin.rb
Overview
This module is used for sharing the license related methods for several types of products.
Constant Summary collapse
- DEFAULT_LICENSE_LANG =
[String] Default license language.
"en_US".freeze
Instance Method Summary collapse
-
#license ⇒ ProductLicense?
Return the license to confirm.
-
#license? ⇒ Boolean
Determines whether the product has a license.
-
#license_confirmation=(confirmed) ⇒ Object
Set license confirmation for the product.
-
#license_confirmation_required? ⇒ Boolean
Determine whether the license should be accepted or not.
-
#license_confirmed? ⇒ Boolean
Determine whether the license is confirmed.
-
#license_content(lang) ⇒ String
Return the license text to be confirmed.
-
#license_locales ⇒ Array<String>
Return available locales for product's license.
Instance Method Details
#license ⇒ ProductLicense?
Return the license to confirm
23 24 25 |
# File 'library/packages/src/lib/y2packager/product_license_mixin.rb', line 23 def license @license ||= ProductLicense.find(name) end |
#license? ⇒ Boolean
Determines whether the product has a license
41 42 43 |
# File 'library/packages/src/lib/y2packager/product_license_mixin.rb', line 41 def license? !!license end |
#license_confirmation=(confirmed) ⇒ Object
Set license confirmation for the product
57 58 59 60 61 |
# File 'library/packages/src/lib/y2packager/product_license_mixin.rb', line 57 def license_confirmation=(confirmed) return unless license confirmed ? license.accept! : license.reject! end |
#license_confirmation_required? ⇒ Boolean
Determine whether the license should be accepted or not
48 49 50 51 52 |
# File 'library/packages/src/lib/y2packager/product_license_mixin.rb', line 48 def license_confirmation_required? return false unless license? license.confirmation_required? end |
#license_confirmed? ⇒ Boolean
Determine whether the license is confirmed
66 67 68 69 70 |
# File 'library/packages/src/lib/y2packager/product_license_mixin.rb', line 66 def license_confirmed? return false unless license license.accepted? || !license_confirmation_required? end |
#license_content(lang) ⇒ String
Return the license text to be confirmed
31 32 33 34 35 |
# File 'library/packages/src/lib/y2packager/product_license_mixin.rb', line 31 def license_content(lang) return "" unless license? license.content_for(lang) end |
#license_locales ⇒ Array<String>
Return available locales for product's license
78 79 80 |
# File 'library/packages/src/lib/y2packager/product_license_mixin.rb', line 78 def license_locales license.locales end |