Sha256: 2b5b2ab829328a01d82f8230ab49bc358aff2d0ef0a5900376ea571d2c4d3686

Contents?: true

Size: 606 Bytes

Versions: 6

Compression:

Stored size: 606 Bytes

Contents

module Hyrax
  module ResourceTypesService
    mattr_accessor :authority
    self.authority = Qa::Authorities::Local.subauthority_for('resource_types')

    def self.select_options
      authority.all.map do |element|
        [element[:label], element[:id]]
      end
    end

    def self.label(id)
      authority.find(id).fetch('term')
    end

    # @param [String] id identifier of the resource type
    def self.microdata_type(id)
      return Hyrax.config.microdata_default_type if id.nil?
      Microdata.fetch("resource_type.#{id}", default: Hyrax.config.microdata_default_type)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hyrax-1.1.1 app/services/hyrax/resource_types_service.rb
hyrax-1.1.0 app/services/hyrax/resource_types_service.rb
hyrax-1.0.5 app/services/hyrax/resource_types_service.rb
hyrax-1.0.4 app/services/hyrax/resource_types_service.rb
hyrax-1.0.3 app/services/hyrax/resource_types_service.rb
hyrax-1.0.2 app/services/hyrax/resource_types_service.rb