Sha256: 6b41519620fa989600af5fe41eacb565ddffbb861259cd06916b38b8b9e9a400

Contents?: true

Size: 391 Bytes

Versions: 7

Compression:

Stored size: 391 Bytes

Contents

module ImproveTypography
  module Processors
    class Ellipsis < Processor
      REGEXP = /(\.\s*?){3,}/i

      def call
        return str unless ellipsis_sign

        str.gsub(REGEXP, ellipsis_sign)
      end

      private

      def ellipsis_sign
        options.fetch(:ellipsis_sign, I18n.t(:ellipsis_sign, scope: %i(improve_typography), locale: locale))
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
improve_typography-0.1.13 lib/improve_typography/processors/ellipsis.rb
improve_typography-0.1.12 lib/improve_typography/processors/ellipsis.rb
improve_typography-0.1.11 lib/improve_typography/processors/ellipsis.rb
improve_typography-0.1.10 lib/improve_typography/processors/ellipsis.rb
improve_typography-0.1.9 lib/improve_typography/processors/ellipsis.rb
improve_typography-0.1.8 lib/improve_typography/processors/ellipsis.rb
improve_typography-0.1.7 lib/improve_typography/processors/ellipsis.rb