Sha256: df14d0cf3209f8413a4f9a017a5b0c9ad429f9d3850ae5a108f062d013646dbb

Contents?: true

Size: 426 Bytes

Versions: 32

Compression:

Stored size: 426 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

Version data entries

32 entries across 32 versions & 2 rubygems

Version Path
locomotive_cms-2.5.7 lib/locomotive/liquid/patches.rb
locomotive_cms-2.5.6 lib/locomotive/liquid/patches.rb
locomotive_cms-2.5.6.rc2 lib/locomotive/liquid/patches.rb
locomotive_cms-2.5.6.rc1 lib/locomotive/liquid/patches.rb
locomotive_cms-2.5.5 lib/locomotive/liquid/patches.rb
locomotive_cms-2.5.4 lib/locomotive/liquid/patches.rb
locomotive_cms-2.5.3 lib/locomotive/liquid/patches.rb
locomotive_cms-2.5.2 lib/locomotive/liquid/patches.rb
locomotive_cms-2.5.1 lib/locomotive/liquid/patches.rb
locomotive_cms-2.5.0 lib/locomotive/liquid/patches.rb
locomotive_cms-2.5.0.rc3 lib/locomotive/liquid/patches.rb
locomotive_cms-2.5.0.rc2 lib/locomotive/liquid/patches.rb
locomotive_cms-2.5.0.rc1 lib/locomotive/liquid/patches.rb
locomotive_cms-2.4.1 lib/locomotive/liquid/patches.rb
locomotive_cms-2.4.0 lib/locomotive/liquid/patches.rb
locomotive_cms-2.3.1 lib/locomotive/liquid/patches.rb
locomotive_cms-2.3.0 lib/locomotive/liquid/patches.rb
locomotive_cms-2.2.3 lib/locomotive/liquid/patches.rb
locomotive_cms-2.2.2 lib/locomotive/liquid/patches.rb
locomotive_cms-2.2.1 lib/locomotive/liquid/patches.rb