Class: Y2Packager::ReleaseNotes

Inherits:
Object
  • Object
show all
Defined in:
library/packages/src/lib/y2packager/release_notes.rb

Overview

Release notes for a given product

This class stores the content and some additional metadata about release notes for a given product.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(product_name:, content:, user_lang:, lang:, format:, version:) ⇒ ReleaseNotes

Constructor

Parameters:

  • product_name (String)

    Product name (internal libzypp name)

  • content (String)

    Release notes content

  • user_lang (String)

    Language asked by user

  • lang (String)

    Contents language

  • format (Symbol)

    Contents format

  • version (String)

    Release notes version (from release notes package)



42
43
44
45
46
47
48
49
# File 'library/packages/src/lib/y2packager/release_notes.rb', line 42

def initialize(product_name:, content:, user_lang:, lang:, format:, version:)
  @product_name = product_name
  @content = content
  @user_lang = user_lang
  @lang = lang
  @version = version
  @format = format
end

Instance Attribute Details

#contentString (readonly)

Returns Release notes content

Returns:

  • (String)

    Release notes content



24
25
26
# File 'library/packages/src/lib/y2packager/release_notes.rb', line 24

def content
  @content
end

#formatSymbol (readonly)

Returns Contents format

Returns:

  • (Symbol)

    Contents format



30
31
32
# File 'library/packages/src/lib/y2packager/release_notes.rb', line 30

def format
  @format
end

#langString (readonly)

Returns Contents language

Returns:

  • (String)

    Contents language



28
29
30
# File 'library/packages/src/lib/y2packager/release_notes.rb', line 28

def lang
  @lang
end

#product_nameString (readonly)

Returns Product name (internal libzypp name)

Returns:

  • (String)

    Product name (internal libzypp name)



22
23
24
# File 'library/packages/src/lib/y2packager/release_notes.rb', line 22

def product_name
  @product_name
end

#user_langString (readonly)

Returns Language asked by user

Returns:

  • (String)

    Language asked by user



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

def user_lang
  @user_lang
end

#versionString (readonly)

Returns Release notes version (from release notes package)

Returns:

  • (String)

    Release notes version (from release notes package)



32
33
34
# File 'library/packages/src/lib/y2packager/release_notes.rb', line 32

def version
  @version
end

Instance Method Details

#matches?(user_lang, format, version) ⇒ Boolean

Determine whether a release notes matches language, format and version requirements

Parameters:

  • user_lang (String)

    Language asked by user

  • format (Symbol)

    Symbol

  • version (String)

    Release note's version

Returns:

  • (Boolean)

    true if it matches; false otherwise.



57
58
59
60
# File 'library/packages/src/lib/y2packager/release_notes.rb', line 57

def matches?(user_lang, format, version)
  self.user_lang == user_lang && self.format == format &&
    (self.version == version || self.version == :latest)
end