Sha256: 2670250d88472570e7b36aa4a53839267fa68bc52979f1d19acd622d8f01393c

Contents?: true

Size: 797 Bytes

Versions: 15

Compression:

Stored size: 797 Bytes

Contents

module Liquid

  class Drop

    def mounting_point
      @context.registers[:mounting_point]
    end

    def site
      @context.registers[:site]
    end

  end

  class Template

    # creates a new <tt>Template</tt> object from liquid source code
    def parse_with_utf8(source, context = {})
      if RUBY_VERSION =~ /1\.9/
        source = source.force_encoding('UTF-8') if source.present?
      end
      self.parse_without_utf8(source, context)
    end

    alias_method_chain :parse, :utf8

  end

  module StandardFilters

    private

    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

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
locomotivecms_wagon-1.2.2 lib/locomotive/wagon/liquid/patches.rb
locomotivecms_wagon-1.2.1 lib/locomotive/wagon/liquid/patches.rb
locomotivecms_wagon-1.2.0 lib/locomotive/wagon/liquid/patches.rb
locomotivecms_wagon-1.1.0 lib/locomotive/wagon/liquid/patches.rb
locomotivecms_wagon-1.0.2 lib/locomotive/wagon/liquid/patches.rb
locomotivecms_wagon-1.0.1 lib/locomotive/wagon/liquid/patches.rb
locomotivecms_wagon-1.0.0 lib/locomotive/wagon/liquid/patches.rb
locomotivecms_builder-1.0.0.alpha8 lib/locomotive/builder/liquid/patches.rb
locomotivecms_builder-1.0.0.alpha7 lib/locomotive/builder/liquid/patches.rb
locomotivecms_builder-1.0.0.alpha6 lib/locomotive/builder/liquid/patches.rb
locomotivecms_builder-1.0.0.alpha5 lib/locomotive/builder/liquid/patches.rb
locomotivecms_builder-1.0.0.alpha4 lib/locomotive/builder/liquid/patches.rb
locomotivecms_builder-1.0.0.alpha3 lib/locomotive/builder/liquid/patches.rb
locomotivecms_builder-1.0.0.alpha2 lib/locomotive/builder/liquid/patches.rb
locomotivecms_builder-1.0.0.alpha1 lib/locomotive/builder/liquid/patches.rb