Class | Versionomy::Schema::Builder |
In: |
lib/versionomy/schema/wrapper.rb
|
Parent: | Object |
These methods are available in a schema definition block given to Versionomy::Schema#create.
Add a module to the schema. All values that use this schema will include this module. This provides a way to add schema-specific capabilities to version numbers.
Provide a default value for the given type. The type should be :integer, :string, or :symbol. You must provide a default value that will be used for all fields of this type, unless explicitly overridden by the field.
Create the root field.
Recognized options include:
:type: | Type of field. This should be :integer, :string, or :symbol. Default is :integer. |
:default_value: | Default value for the field if no value is explicitly set. Default is 0 for an integer field, the empty string for a string field, or the first symbol added for a symbol field. |
You may provide an optional block. Within the block, you may call methods of Versionomy::Schema::FieldBuilder to customize this field.
Raises Versionomy::Errors::IllegalValueError if the given default value is not legal.
Raises Versionomy::Errors::RangeOverlapError if a root field has already been created.
Provide a default compare procedure for the given type. The type should be :integer, :string, or :symbol. You must provide a block that takes two values and returns a standard comparison result— that is, a negative integer if the first value is less, 0 if the values are equal, or a positive integer if the first value is greater. This procedure will be used for all fields of this type, unless explicitly overridden by the field.