Class: Dor::ReleaseTags::Purl

Inherits:
Object
  • Object
show all
Defined in:
lib/dor/release_tags/purl.rb

Instance Method Summary collapse

Constructor Details

#initialize(pid:, purl_host:) ⇒ Purl

Determine projects in which an item is released

Parameters:

  • pid (String)

    identifier of the item to get the release tags for



8
9
10
11
# File 'lib/dor/release_tags/purl.rb', line 8

def initialize(pid:, purl_host:)
  @pid = pid
  @purl_host = purl_host
end

Instance Method Details

#released_for(new_tags) ⇒ Hash{String => Boolean}

This function calls purl and gets a list of all release tags currently in purl. It then compares to the list you have generated. Any tag that is on purl, but not in the newly generated list is added to the new list with a value of false.

Parameters:

  • new_tags (Hash{String => Boolean})

    all new tags in the form of {“Project” => Boolean}

Returns:

  • (Hash{String => Boolean})

    all namespaces, keys are Project name Strings, values are Boolean



17
18
19
20
21
22
23
# File 'lib/dor/release_tags/purl.rb', line 17

def released_for(new_tags)
  missing_tags = release_tags_from_purl.map(&:downcase) - new_tags.keys.map(&:downcase)
  missing_tags.each do |missing_tag|
    new_tags[missing_tag.capitalize] = { 'release' => false }
  end
  new_tags
end