Sha256: d113256db49499020b7c664deed61afcb21490418e0ae8cbb3f9d753efda1fe2

Contents?: true

Size: 656 Bytes

Versions: 5

Compression:

Stored size: 656 Bytes

Contents

module Amakanize
  module Filters
    class TrailingDashDeletionFilter < BaseFilter
      TOKENS = %w(
        ̃
        ̰
        ̴
        ‒
        –
        —
        ―
        ⁓
        〜
        〰
        ˜
        ˷
        ~
        ~
        ∼
        ─
      )

      # @note Override
      # @param output [String] e.g. `"アド・アストラ 1 ─スキピオとハンニバル─"`
      # @return [Hash] e.g. `"アド・アストラ 1"`
      def call(context:, output:)
        {
          context: context,
          output: output.gsub(/\s*#{::Regexp.union(TOKENS)}.*/, ""),
        }
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
amakanize-0.6.0 lib/amakanize/filters/trailing_dash_deletion_filter.rb
amakanize-0.5.3 lib/amakanize/filters/trailing_dash_deletion_filter.rb
amakanize-0.5.2 lib/amakanize/filters/trailing_dash_deletion_filter.rb
amakanize-0.5.1 lib/amakanize/filters/trailing_dash_deletion_filter.rb
amakanize-0.5.0 lib/amakanize/filters/trailing_dash_deletion_filter.rb