Sha256: 93ea1daeb3a600f056364b5f2b8f9f87e7912c5dc622a4768e0284632ff03af8

Contents?: true

Size: 953 Bytes

Versions: 1

Compression:

Stored size: 953 Bytes

Contents

module Hydra::Works
  class RemoveGenericWorkFromCollection

    ##
    # Remove a generic_work from a collection.
    #
    # @param [Hydra::Works::Collection] :parent_collection from which to remove generic_work
    # @param [Hydra::Works::GenericWork::Base] :child_generic_work being removed
    # @param [Fixnum] :nth_occurrence remove nth occurrence of this generic_work in the list (default=1)
    #
    # @return [Hydra::Works::Collection] the updated hydra works collection

    def self.call( parent_collection, child_generic_work, nth_occurrence=1 )
      raise ArgumentError, 'parent_collection must be a hydra-works collection' unless Hydra::Works.collection? parent_collection
      raise ArgumentError, 'child_generic_work must be a hydra-works generic work' unless Hydra::Works.generic_work? child_generic_work
      Hydra::PCDM::RemoveObjectFromCollection.call( parent_collection, child_generic_work, nth_occurrence )
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hydra-works-0.0.1 lib/hydra/works/services/collection/remove_generic_work.rb