Class | Versionomy::Conversion::Base |
In: |
lib/versionomy/conversion/base.rb
|
Parent: | Object |
The base conversion class.
This base class defines the API for a conversion. All conversions must define the method convert_value documented here. Conversions need not actually extend this base class, as long as they duck-type this method. However, this base class does provide a few convenience methods such as a sane implementation of inspect.
Create a conversion using a simple DSL. You can pass a block to the initializer that takes the same parameters as convert_value, and the conversion will use that block to perform the conversion.
Convert the given value to the given format and return the converted value.
The convert_params may be interpreted however the particular conversion wishes.
Raises Versionomy::Errors::ConversionError if the conversion failed.