Class: Format::Modifier
- Inherits:
-
Object
- Object
- Format::Modifier
- Defined in:
- lib/src/format/modifier.rb
Instance Method Summary collapse
- #apply(raw_value, modifiers) ⇒ Object
-
#initialize(yml, helper) ⇒ Modifier
constructor
A new instance of Modifier.
Constructor Details
#initialize(yml, helper) ⇒ Modifier
Returns a new instance of Modifier.
5 6 7 8 |
# File 'lib/src/format/modifier.rb', line 5 def initialize(yml, helper) @debug = yml.fetch(:debug, false) @helper = helper end |
Instance Method Details
#apply(raw_value, modifiers) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/src/format/modifier.rb', line 10 def apply(raw_value, modifiers) [modifiers].flatten.compact.reduce(raw_value) do |value, modifier| method_name, params = modifier_props(modifier).values_at(:name, :params) modify_value(value, method_name, params) end end |