Module: Hyrax::ResourceTypesService
- Defined in:
- app/services/hyrax/resource_types_service.rb
Class Method Summary collapse
- .label(id) ⇒ Object
-
.microdata_type(id) ⇒ String
A schema.org type.
- .select_options ⇒ Object
Class Method Details
.label(id) ⇒ Object
12 13 14 |
# File 'app/services/hyrax/resource_types_service.rb', line 12 def self.label(id) .find(id).fetch('term') end |
.microdata_type(id) ⇒ String
Returns 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_options ⇒ Object
6 7 8 9 10 |
# File 'app/services/hyrax/resource_types_service.rb', line 6 def self. .all.map do |element| [element[:label], element[:id]] end end |