Class: Locomotive::Steam::Liquid::Filters::Number::NumberProxyHelper
- Inherits:
-
Object
- Object
- Locomotive::Steam::Liquid::Filters::Number::NumberProxyHelper
- Includes:
- ActiveSupport::NumberHelper
- Defined in:
- lib/locomotive/steam/liquid/filters/number.rb
Instance Method Summary collapse
-
#initialize(name, context) ⇒ NumberProxyHelper
constructor
A new instance of NumberProxyHelper.
- #interpolate_options(options) ⇒ Object
- #invoke(input, options) ⇒ Object
Constructor Details
#initialize(name, context) ⇒ NumberProxyHelper
Returns a new instance of NumberProxyHelper.
27 28 29 30 |
# File 'lib/locomotive/steam/liquid/filters/number.rb', line 27 def initialize(name, context) @name = name @context = context end |
Instance Method Details
#interpolate_options(options) ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/locomotive/steam/liquid/filters/number.rb', line 36 def () ( || {}).transform_values do |option| if option.is_a?(String) _option = ::Liquid::Expression.parse(option) @context.evaluate(_option) || option else option end end end |
#invoke(input, options) ⇒ Object
32 33 34 |
# File 'lib/locomotive/steam/liquid/filters/number.rb', line 32 def invoke(input, ) send :"number_to_#{@name}", input, () end |