Sha256: ac3d1330b62e4446ab8a8dc3ce1b66ab0bc0ff038ea355dca227e5d84a6712d6

Contents?: true

Size: 422 Bytes

Versions: 2

Compression:

Stored size: 422 Bytes

Contents

# frozen_string_literal: true

module Jekyll
  module Filters
    # Extracts numbers from a String, useful for converting phone
    # numbers to tel: links.
    #
    # @param [String]
    # @return [String]
    module Numbers
      def numbers(input)
        return unless input.respond_to? :gsub

        input.gsub(%r{[^0-9]}, '')
      end
    end
  end
end

Liquid::Template.register_filter(Jekyll::Filters::Numbers)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sutty-liquid-0.2.1 lib/jekyll/filters/number.rb
sutty-liquid-0.2.0 lib/jekyll/filters/number.rb