Class: Hyrax::SimpleSchemaLoader::AttributeDefinition Private
- Inherits:
-
Object
- Object
- Hyrax::SimpleSchemaLoader::AttributeDefinition
- Defined in:
- app/services/hyrax/simple_schema_loader.rb
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.
Defined Under Namespace
Classes: Identity
Instance Attribute Summary collapse
- #config ⇒ Object readonly private
- #name ⇒ Object readonly private
Instance Method Summary collapse
- #form_options ⇒ Hash{Symbol => Object} private
- #index_keys ⇒ Enumerable<Symbol> private
-
#initialize(name, config) ⇒ AttributeDefinition
constructor
private
A new instance of AttributeDefinition.
- #type ⇒ Dry::Types::Type private
Constructor Details
#initialize(name, config) ⇒ AttributeDefinition
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 new instance of AttributeDefinition.
65 66 67 68 |
# File 'app/services/hyrax/simple_schema_loader.rb', line 65 def initialize(name, config) @config = config @name = name.to_sym end |
Instance Attribute Details
#config ⇒ Object (readonly)
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.
60 61 62 |
# File 'app/services/hyrax/simple_schema_loader.rb', line 60 def config @config end |
#name ⇒ Object (readonly)
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.
60 61 62 |
# File 'app/services/hyrax/simple_schema_loader.rb', line 60 def name @name end |
Instance Method Details
#form_options ⇒ 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.
72 73 74 |
# File 'app/services/hyrax/simple_schema_loader.rb', line 72 def config.fetch('form', {}).symbolize_keys end |
#index_keys ⇒ Enumerable<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.
78 79 80 |
# File 'app/services/hyrax/simple_schema_loader.rb', line 78 def index_keys config.fetch('index_keys', []).map(&:to_sym) end |
#type ⇒ 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.
84 85 86 87 88 89 90 91 |
# File 'app/services/hyrax/simple_schema_loader.rb', line 84 def type collection_type = if config['multiple'] Valkyrie::Types::Array.constructor { |v| Array(v).select(&:present?) } else Identity end collection_type.of(type_for(config['type'])) end |