Class: Hyrax::SimpleSchemaLoader Private
- Inherits:
-
Object
- Object
- Hyrax::SimpleSchemaLoader
- Defined in:
- app/services/hyrax/simple_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.
This is a simple yaml config-driven schema loader
Defined Under Namespace
Classes: AttributeDefinition, UndefinedSchemaError
Instance Method Summary collapse
-
#attributes_for(schema:) ⇒ Hash<Symbol, Dry::Types::Type>
private
A map from attribute names to types.
- #form_definitions_for(schema:) ⇒ Hash{Symbol => Hash{Symbol => Object}} private
-
#index_rules_for(schema:) ⇒ {Symbol => Symbol}
private
A map from index keys to attribute names.
Instance Method Details
#attributes_for(schema:) ⇒ Hash<Symbol, Dry::Types::Type>
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.
Returns a map from attribute names to types.
16 17 18 19 20 |
# File 'app/services/hyrax/simple_schema_loader.rb', line 16 def attributes_for(schema:) definitions(schema).each_with_object({}) do |definition, hash| hash[definition.name] = definition.type end end |
#form_definitions_for(schema:) ⇒ Hash{Symbol => Hash{Symbol => 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.
26 27 28 29 30 31 32 |
# File 'app/services/hyrax/simple_schema_loader.rb', line 26 def form_definitions_for(schema:) definitions(schema).each_with_object({}) do |definition, hash| next if definition..empty? hash[definition.name] = definition. end end |
#index_rules_for(schema:) ⇒ {Symbol => Symbol}
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.
Returns a map from index keys to attribute names.
38 39 40 41 42 43 44 |
# File 'app/services/hyrax/simple_schema_loader.rb', line 38 def index_rules_for(schema:) definitions(schema).each_with_object({}) do |definition, hash| definition.index_keys.each do |key| hash[key] = definition.name end end end |