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.
- #invoke(input, options) ⇒ Object
- #parse_and_interpolate_options(string_or_array) ⇒ 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
#invoke(input, options) ⇒ Object
32 33 34 35 |
# File 'lib/locomotive/steam/liquid/filters/number.rb', line 32 def invoke(input, ) = () send :"number_to_#{@name}", input, end |
#parse_and_interpolate_options(string_or_array) ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/locomotive/steam/liquid/filters/number.rb', line 37 def (string_or_array) return {} if string_or_array.empty? string = [*string_or_array].flatten.join(', ') arguments = Solid::Arguments.parse(string) (arguments.interpolate(@context).first || {}) end |