Class: Hyrax::Schema Private

Inherits:
Module
  • Object
show all
Defined in:
lib/hyrax/schema.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.

A module specifying a Schema (set of attributes and types) that can be applied to a `Valkyrie::Resource`. This provides the internals for the recommended module builder syntax: `Hyrax::Schema(:schema_name)`

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(schema_name, schema_loader: SimpleSchemaLoader.new) ⇒ Schema

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.

Note:

use Hyrax::Schema(:my_schema) instead

Returns a new instance of Schema.

Parameters:

  • schema_name (Symbol)

64
65
66
67
# File 'lib/hyrax/schema.rb', line 64

def initialize(schema_name, schema_loader: SimpleSchemaLoader.new)
  @name = schema_name
  @schema_loader = schema_loader
end

Instance Attribute Details

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


56
57
58
# File 'lib/hyrax/schema.rb', line 56

def name
  @name
end

Instance Method Details

#attributesHash{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:

  • (Hash{Symbol => Dry::Types::Type})

71
72
73
# File 'lib/hyrax/schema.rb', line 71

def attributes
  @schema_loader.attributes_for(schema: name)
end

#inspectString

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:

  • (String)

77
78
79
# File 'lib/hyrax/schema.rb', line 77

def inspect
  "#{self.class}(#{@name})"
end