Module: Hyrax::ResourceTypesService

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

Class Method Summary collapse

Class Method Details

.label(id) ⇒ Object



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

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.



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

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



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

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