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)


67
68
69
70
# File 'lib/hyrax/schema.rb', line 67

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.



59
60
61
# File 'lib/hyrax/schema.rb', line 59

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})


74
75
76
# File 'lib/hyrax/schema.rb', line 74

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)


80
81
82
# File 'lib/hyrax/schema.rb', line 80

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