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

Version Path
locomotivecms_steam-1.5.0.rc0 lib/locomotive/steam/liquid/patches.rb
locomotivecms_steam-1.5.0.beta3 lib/locomotive/steam/liquid/patches.rb
locomotivecms_steam-1.5.0.beta2 lib/locomotive/steam/liquid/patches.rb
locomotivecms_steam-1.5.0.beta1 lib/locomotive/steam/liquid/patches.rb
locomotivecms_steam-1.4.1 lib/locomotive/steam/liquid/patches.rb
locomotivecms_steam-1.4.0 lib/locomotive/steam/liquid/patches.rb
locomotivecms_steam-1.4.0.rc2 lib/locomotive/steam/liquid/patches.rb
locomotivecms_steam-1.4.0.rc1 lib/locomotive/steam/liquid/patches.rb
locomotivecms_steam-1.4.0.pre.rc.1 lib/locomotive/steam/liquid/patches.rb
locomotivecms_steam-1.3.0 lib/locomotive/steam/liquid/patches.rb
locomotivecms_steam-1.3.0.rc2 lib/locomotive/steam/liquid/patches.rb
locomotivecms_steam-1.1.2 lib/locomotive/steam/liquid/patches.rb
locomotivecms_steam-1.2.1 lib/locomotive/steam/liquid/patches.rb
locomotivecms_steam-1.3.0.rc1 lib/locomotive/steam/liquid/patches.rb
locomotivecms_steam-1.2.0 lib/locomotive/steam/liquid/patches.rb
locomotivecms_steam-1.2.0.rc3 lib/locomotive/steam/liquid/patches.rb
locomotivecms_steam-1.2.0.rc2 lib/locomotive/steam/liquid/patches.rb
locomotivecms_steam-1.2.0.rc1 lib/locomotive/steam/liquid/patches.rb
locomotivecms_steam-1.2.0.beta1 lib/locomotive/steam/liquid/patches.rb
locomotivecms_steam-1.1.1 lib/locomotive/steam/liquid/patches.rb