Class: Y2Packager::ReleaseNotesStore

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

Overview

Release notes store

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeReleaseNotesStore

Constructor



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

def initialize
  @release_notes = {}
end

Class Method Details

.currentObject



20
21
22
# File 'library/packages/src/lib/y2packager/release_notes_store.rb', line 20

def current
  @current ||= new
end

Instance Method Details

#clearObject

Clear store



51
52
53
# File 'library/packages/src/lib/y2packager/release_notes_store.rb', line 51

def clear
  release_notes.clear
end

#retrieve(product_name, user_lang, format, version) ⇒ ReleaseNotes

Retrieve release notes for a given product, lang, format and version

Parameters:

  • product_name (String)

    Product name

  • user_lang (String)

    Language asked by user

  • format (Symbol)

    Symbol

  • version (String, Symbol)

    Release note version (or :latest)

Returns:



37
38
39
40
41
# File 'library/packages/src/lib/y2packager/release_notes_store.rb', line 37

def retrieve(product_name, user_lang, format, version)
  rn = release_notes[product_name]
  return nil if rn.nil?
  rn.matches?(user_lang, format, version) ? rn : nil
end

#store(rn) ⇒ Object

Store release notes for later retrieval

Parameters:



46
47
48
# File 'library/packages/src/lib/y2packager/release_notes_store.rb', line 46

def store(rn)
  release_notes[rn.product_name] = rn
end