app/models/bplmodels/mods_desc_metadata.rb
def insert_genre(value=nil, value_uri=nil, authority=nil, display_label='specific')
      #Prevent duplicates
      if value.present? && !self.mods(0).genre.any?{ |genre| genre == value}
        genre_index = self.mods(0).genre.count

        self.mods(0).genre(genre_index, value) unless value.blank?

        unless authority.blank?
          self.mods(0).genre(genre_index).authority = authority
          self.mods(0).genre(genre_index).authorityURI = BplEnrich::Authorities.authority_uri(authority)
        end

        if value_uri.present? && value_uri.match(/^http/).blank?
          value_uri = "#{BplEnrich::Authorities.authority_uri(authority)}/#{value_uri}"
        end

        self.mods(0).genre(genre_index).valueURI = value_uri unless value_uri.blank?

        self.mods(0).genre(genre_index).displayLabel = display_label unless display_label.blank?
      end
    end
#include Hydra::Datastream::CommonModsIndexMethods
# MODS XML constants.
include Hydra::Datastream::CommonModsIndexMethods
MODS XML constants.
include Hydra :: Datastream :: CommonModsIndexMethods MODS XML constants .
def insert_genre(value=nil, value_uri=nil, authority=nil, display_label='specific')
      if value.present? && !self.mods(0).genre.any?{ |genre| genre == value}
        genre_index = self.mods(0).genre.count
        self.mods(0).genre(genre_index, value) unless value.blank?
        unless authority.blank?
          self.mods(0).genre(genre_index).authority = authority
          self.mods(0).genre(genre_index).authorityURI = BplEnrich::Authorities.authority_uri(authority)
        end
        if value_uri.present? && value_uri.match(/^http/).blank?
          value_uri = "#{BplEnrich::Authorities.authority_uri(authority)}/#{value_uri}"
        end
        self.mods(0).genre(genre_index).valueURI = value_uri unless value_uri.blank?
        self.mods(0).genre(genre_index).displayLabel = display_label unless display_label.blank?
      end
    end
def insert_genre ( value = nil , value_uri = nil , authority = nil , display_label = 'specific' ) if value . present? && ! self . mods ( 0 ) . genre . any? { | genre | genre == value } genre_index = self . mods ( 0 ) . genre . count self . mods ( 0 ) . genre ( genre_index , value ) unless value . blank? unless authority . blank? self . mods ( 0 ) . genre ( genre_index ) . authority = authority self . mods ( 0 ) . genre ( genre_index ) . authorityURI = BplEnrich :: Authorities . authority_uri ( authority ) end if value_uri . present? && value_uri . match ( / ^http / ) . blank? value_uri = "#{BplEnrich::Authorities.authority_uri(authority)}/#{value_uri}" end self . mods ( 0 ) . genre ( genre_index ) . valueURI = value_uri unless value_uri . blank? self . mods ( 0 ) . genre ( genre_index ) . displayLabel = display_label unless display_label . blank? end end
include Hydra::Datastream::CommonModsIndexMethods
MODS XML constants.
include Hydra :: Datastream :: CommonModsIndexMethods MODS XML constants .
#Prevent duplicates
value
value_uri
authority
display_label