Class: Stringento::Formatter
- Inherits:
-
Object
- Object
- Stringento::Formatter
- Defined in:
- lib/stringento/formatter.rb
Overview
Base class / base implementation of a formatter. In order to customize formatting:
-
Derive subclass
-
Implement formatter methods ending in: _formatter.
-
Pass instance into into Stringento#evaluate
Instance Method Summary collapse
Instance Method Details
#formatter(method, value, arg = '') ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/stringento/formatter.rb', line 21 def formatter(method, value, arg = '') method_name = "#{method}#{METHOD_SUFFIX}" if respond_to?(method_name) send(method_name, value, arg) else value.to_s end end |