Class: Hyrax::Schema Private
- Inherits:
-
Module
- Object
- Module
- Hyrax::Schema
- 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)`
Instance Attribute Summary collapse
- #contexts ⇒ Object readonly private
- #name ⇒ Symbol readonly
- #version ⇒ Object readonly private
Class Method Summary collapse
- .m3_schema_loader ⇒ Object private
- .simple_schema_loader ⇒ Object private
Instance Method Summary collapse
- #attributes ⇒ Hash{Symbol => Dry::Types::Type} private
-
#initialize(schema_name, schema_loader: Hyrax::Schema.simple_schema_loader, schema_version: nil, contexts: []) ⇒ Schema
constructor
private
A new instance of Schema.
- #inspect ⇒ String private
Constructor Details
#initialize(schema_name, schema_loader: Hyrax::Schema.simple_schema_loader, schema_version: nil, contexts: []) ⇒ 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.
use Hyrax::Schema(:my_schema) instead
Returns a new instance of Schema.
76 77 78 79 80 81 |
# File 'lib/hyrax/schema.rb', line 76 def initialize(schema_name, schema_loader: Hyrax::Schema.simple_schema_loader, schema_version: nil, contexts: []) @name = schema_name.to_s @version = schema_version || schema_loader.current_version @schema_loader = schema_loader @contexts = contexts end |
Instance Attribute Details
#contexts ⇒ 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.
59 60 61 |
# File 'lib/hyrax/schema.rb', line 59 def contexts @contexts end |
#name ⇒ Symbol (readonly)
59 60 61 |
# File 'lib/hyrax/schema.rb', line 59 def name @name end |
#version ⇒ 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.
59 60 61 |
# File 'lib/hyrax/schema.rb', line 59 def version @version end |
Class Method Details
.m3_schema_loader ⇒ 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.
62 63 64 |
# File 'lib/hyrax/schema.rb', line 62 def self.m3_schema_loader M3SchemaLoader.new end |
.simple_schema_loader ⇒ 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.
66 67 68 |
# File 'lib/hyrax/schema.rb', line 66 def self.simple_schema_loader SimpleSchemaLoader.new end |
Instance Method Details
#attributes ⇒ 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.
85 86 87 |
# File 'lib/hyrax/schema.rb', line 85 def attributes @schema_loader.attributes_for(schema: name, version:, contexts:) end |
#inspect ⇒ String
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.
91 92 93 |
# File 'lib/hyrax/schema.rb', line 91 def inspect "#{self.class}(#{@name})" end |