module ROM::Files::Plugins::Schema::Contents
A plugin for automatically adding contents of file to the schema definition
@example Generic `DATA` field with String type
schema do use :contents end
@example Specify another type
schema do use :contents, type: Types::YAML end
@example Specify another name
# using other types schema do use :contents, name: :contents end
@api public
Constants
- NAME
- TYPE
Public Class Methods
apply(schema, name: NAME, type: TYPE)
click to toggle source
@api private
# File lib/rom/files/plugins/schema/contents.rb, line 35 def self.apply(schema, name: NAME, type: TYPE) contents = type.meta(name: name, source: schema.name, DATA: true) schema.attributes.concat( schema.class.attributes([contents], schema.attr_class) ) end