Class: Hyrax::M3SchemaLoader Private
- Inherits:
-
SchemaLoader
- Object
- SchemaLoader
- Hyrax::M3SchemaLoader
- Defined in:
- app/services/hyrax/m3_schema_loader.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Read m3 profiles from the database
Instance Method Summary collapse
- #config_paths(schema_name = 'm3_profile') ⇒ Object private
- #current_version ⇒ Object private
- #view_definitions_for(schema:, version: 1, contexts: nil) ⇒ Object private
Methods inherited from SchemaLoader
#attributes_for, #form_definitions_for, #index_rules_for
Instance Method Details
#config_paths(schema_name = 'm3_profile') ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
22 23 24 25 26 27 |
# File 'app/services/hyrax/m3_schema_loader.rb', line 22 def config_paths(schema_name = 'm3_profile') config_search_paths.collect do |root_path| path = root_path.to_s + "/config/metadata_profiles/#{schema_name}.yaml" path if File.exist?(path) end.compact end |
#current_version ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
29 30 31 32 33 |
# File 'app/services/hyrax/m3_schema_loader.rb', line 29 def current_version Hyrax::FlexibleSchema.current_schema_id rescue ActiveRecord::StatementInvalid # allow for moments when the database is not yet initialized 0 end |
#view_definitions_for(schema:, version: 1, contexts: nil) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
11 12 13 14 15 16 17 18 19 20 |
# File 'app/services/hyrax/m3_schema_loader.rb', line 11 def view_definitions_for(schema:, version: 1, contexts: nil) definitions(schema, version, contexts).each_with_object({}) do |definition, hash| = definition. # display_label and admin_only keys are always added to the view_options hash # if there are no other view options, skip this field next if .without(:display_label, :admin_only).empty? hash[definition.name] = definition. end end |