Module: Hyrax::ResourceTypesService

Defined in:
app/services/hyrax/resource_types_service.rb

Class Method Summary collapse

Class Method Details

.label(id) ⇒ Object



13
14
15
# File 'app/services/hyrax/resource_types_service.rb', line 13

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

.microdata_type(id) ⇒ String

Returns a schema.org type. Gives the default type if ‘id` is nil.

Parameters:

  • id (String, nil)

    identifier of the resource type

Returns:

  • (String)

    a schema.org type. Gives the default type if ‘id` is nil.



21
22
23
24
# File 'app/services/hyrax/resource_types_service.rb', line 21

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

.select_optionsObject



7
8
9
10
11
# File 'app/services/hyrax/resource_types_service.rb', line 7

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