Sha256: f55dd3b67b74f2c205b1e802fb388cd13638a87646671d69cf15204b4873693a
Contents?: true
Size: 973 Bytes
Versions: 22
Compression:
Stored size: 973 Bytes
Contents
module ActiveFedora module WithMetadata extend ActiveSupport::Concern extend ActiveSupport::Autoload autoload :MetadataNode def metadata_node @metadata_node ||= self.class.metadata_schema.new(self) end def save(*) if super metadata_node.metadata_uri = described_by # TODO only necessary if the URI was < > before metadata_node.save # TODO if changed? end end module ClassMethods def metadata(&block) metadata_schema.exec_block(&block) end def metadata_schema @metadata_schema ||= MetadataNode(self) end # Make a subclass of MetadataNode named GeneratedMetadataSchema and set its # parent_class attribute to have the value of the current class. def MetadataNode(parent_klass) klass = self.const_set(:GeneratedMetadataSchema, Class.new(MetadataNode)) klass.parent_class = parent_klass klass end end end end
Version data entries
22 entries across 22 versions & 1 rubygems