Sha256: b804dd5c98f9e50a8ebe322e2ecb3eac907e218429d65ff65c1b907b0395bc27

Contents?: true

Size: 1003 Bytes

Versions: 19

Compression:

Stored size: 1003 Bytes

Contents

# -*- encoding : utf-8 -*-

module PragmaticSegmenter
  module Rules
    # This class searches for ellipses within a string and
    # replaces the periods.

    # http://www.dailywritingtips.com/in-search-of-a-4-dot-ellipsis/
    # http://www.thepunctuationguide.com/ellipses.html

    module EllipsisRules
      # Rubular: http://rubular.com/r/i60hCK81fz
      ThreeConsecutiveRule = Rule.new(/\.\.\.(?=\s+[A-Z])/, '☏.')

      # Rubular: http://rubular.com/r/Hdqpd90owl
      FourConsecutiveRule = Rule.new(/(?<=\S)\.{3}(?=\.\s[A-Z])/, 'ƪ')

      # Rubular: http://rubular.com/r/YBG1dIHTRu
      ThreeSpaceRule = Rule.new(/(\s\.){3}\s/, '♟')

      # Rubular: http://rubular.com/r/2VvZ8wRbd8
      FourSpaceRule = Rule.new(/(?<=[a-z])(\.\s){3}\.(\z|$|\n)/, '♝')

      OtherThreePeriodRule = Rule.new(/\.\.\./, 'ƪ')

      All = [
        ThreeSpaceRule,
        FourSpaceRule,
        FourConsecutiveRule,
        ThreeConsecutiveRule,
        OtherThreePeriodRule
      ]
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
pragmatic_segmenter-0.3.3 lib/pragmatic_segmenter/rules/ellipsis.rb
pragmatic_segmenter-0.3.2 lib/pragmatic_segmenter/rules/ellipsis.rb
pragmatic_segmenter-0.3.1 lib/pragmatic_segmenter/ellipsis.rb
pragmatic_segmenter-0.3.0 lib/pragmatic_segmenter/ellipsis.rb
pragmatic_segmenter-0.2.0 lib/pragmatic_segmenter/ellipsis.rb
pragmatic_segmenter-0.1.8 lib/pragmatic_segmenter/ellipsis.rb
pragmatic_segmenter-0.1.7 lib/pragmatic_segmenter/ellipsis.rb
pragmatic_segmenter-0.1.6 lib/pragmatic_segmenter/ellipsis.rb
pragmatic_segmenter-0.1.5 lib/pragmatic_segmenter/ellipsis.rb
pragmatic_segmenter-0.1.4 lib/pragmatic_segmenter/ellipsis.rb
pragmatic_segmenter-0.1.3 lib/pragmatic_segmenter/ellipsis.rb
pragmatic_segmenter-0.1.2 lib/pragmatic_segmenter/ellipsis.rb
pragmatic_segmenter-0.1.1 lib/pragmatic_segmenter/ellipsis.rb
pragmatic_segmenter-0.1.0 lib/pragmatic_segmenter/ellipsis.rb
pragmatic_segmenter-0.0.9 lib/pragmatic_segmenter/ellipsis.rb
pragmatic_segmenter-0.0.8 lib/pragmatic_segmenter/ellipsis.rb
pragmatic_segmenter-0.0.7 lib/pragmatic_segmenter/ellipsis.rb
pragmatic_segmenter-0.0.6 lib/pragmatic_segmenter/ellipsis.rb
pragmatic_segmenter-0.0.5 lib/pragmatic_segmenter/ellipsis.rb