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


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

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
42
# 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(release_note) ⇒ Object

Store release notes for later retrieval

Parameters:


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

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