Sha256: 68b4f3a2369eebac6af1c6b6428392a6276ffa1c56496d0e487c46ad0c8f7f04
Contents?: true
Size: 855 Bytes
Versions: 27
Compression:
Stored size: 855 Bytes
Contents
module Liquid module StandardFilters private # Fixme: Handle DateTime, Date and Time objects, convert them # into seconds (integer) def to_number(obj) case obj when Numeric obj when String (obj.strip =~ /^\d+\.\d+$/) ? obj.to_f : obj.to_i when DateTime, Date, Time obj.to_time.to_i else 0 end end end end module Liquid module OptionsBuilder private def parse_options_from_string(string) string.try(:strip!) return nil if string.blank? string = string.gsub(/^(\s*,)/, '') Solid::Arguments.parse(string) end def interpolate_options(options, context) if options options.interpolate(context).first else {} end end end end Liquid::Tag.send(:include, Liquid::OptionsBuilder)
Version data entries
27 entries across 27 versions & 1 rubygems