Class: Aequitas::MessageTransformer Abstract
- Inherits:
-
Object
- Object
- Aequitas::MessageTransformer
- Defined in:
- lib/aequitas/message_transformer.rb
Overview
This class is abstract.
Subclass and override #transform to implement a custom message transformer. Use Violation.default_transformer= to set a new default message transformer or pass the transformer to Violation#message.
Transforms Violations to error message strings.
Direct Known Subclasses
Defined Under Namespace
Classes: DefaultI18n, DefaultStatic
Class Method Summary collapse
-
.default ⇒ MessageTransformer
Get the default MessageTransformer for this process.
Instance Method Summary collapse
-
#transform(violation) ⇒ String
Transforms the specified Violation to an error message string.
Class Method Details
.default ⇒ MessageTransformer
Get the default MessageTransformer for this process
19 20 21 |
# File 'lib/aequitas/message_transformer.rb', line 19 def self.default defined?(::I18n) ? DefaultI18n.new : DefaultStatic.new end |
Instance Method Details
#transform(violation) ⇒ String
Transforms the specified Violation to an error message string.
33 34 35 |
# File 'lib/aequitas/message_transformer.rb', line 33 def transform(violation) raise NotImplementedError, "#{self.class}#transform has not been implemented" end |