From b06b7b50aa083a2d4f86d485fba14681b9124264 Mon Sep 17 00:00:00 2001 From: Didier Lafforgue Date: Mon, 2 Apr 2012 11:57:52 +0200 Subject: [PATCH] the filter base file was missing, my bad (thanks Joel) --- lib/locomotive/liquid/filters/base.rb | 47 +++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 lib/locomotive/liquid/filters/base.rb diff --git a/lib/locomotive/liquid/filters/base.rb b/lib/locomotive/liquid/filters/base.rb new file mode 100644 index 00000000..638b09ed --- /dev/null +++ b/lib/locomotive/liquid/filters/base.rb @@ -0,0 +1,47 @@ +module Locomotive + module Liquid + module Filters + module Base + + protected + + # Convert an array of properties ('key:value') into a hash + # Ex: ['width:50', 'height:100'] => { :width => '50', :height => '100' } + def args_to_options(*args) + options = {} + args.flatten.each do |a| + if (a =~ /^(.*):(.*)$/) + options[$1.to_sym] = $2 + end + end + options + end + + # Write options (Hash) into a string according to the following pattern: + # ="", ="