Class: Hyrax::SimpleSchemaLoader::AttributeDefinition Private

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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.

Parameters:

  • name (#to_sym)
  • config (Hash<String, Object>)

59
60
61
62
# File 'app/services/hyrax/simple_schema_loader.rb', line 59

def initialize(name, config)
  @config = config
  @name   = name.to_sym
end

Instance Attribute Details

#configObject (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.


54
55
56
# File 'app/services/hyrax/simple_schema_loader.rb', line 54

def config
  @config
end

#nameObject (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.


54
55
56
# File 'app/services/hyrax/simple_schema_loader.rb', line 54

def name
  @name
end

Instance Method Details

#form_optionsHash{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.

Returns:

  • (Hash{Symbol => Object})

66
67
68
# File 'app/services/hyrax/simple_schema_loader.rb', line 66

def form_options
  config.fetch('form', {}).symbolize_keys
end

#index_keysEnumerable<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:

  • (Enumerable<Symbol>)

72
73
74
# File 'app/services/hyrax/simple_schema_loader.rb', line 72

def index_keys
  config.fetch('index_keys', []).map(&:to_sym)
end

#typeDry::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:

  • (Dry::Types::Type)

78
79
80
81
# File 'app/services/hyrax/simple_schema_loader.rb', line 78

def type
  collection_type = config['multiple'] ? Valkyrie::Types::Array : Identity
  collection_type.of(type_for(config['type']))
end