Class: Calyx::Modifiers
- Inherits:
-
Object
- Object
- Calyx::Modifiers
- Defined in:
- lib/calyx/modifiers.rb
Overview
Applies modifiers to the output of a rule in a template substitution.
Instance Method Summary collapse
-
#transform(name, value) ⇒ String
Transforms an output string by delegating to the given output function.
Instance Method Details
#transform(name, value) ⇒ String
Transforms an output string by delegating to the given output function.
If a registered modifier method is not found, then delegate to the given string function.
If an invalid modifier function is given, returns the raw input string.
14 15 16 17 18 19 20 21 22 |
# File 'lib/calyx/modifiers.rb', line 14 def transform(name, value) if respond_to?(name) send(name, value) elsif value.respond_to?(name) value.send(name) else value end end |