Sha256: c8472b69cb3fac08f72657e5d211b251d8f42cfdd7044adf0fa473a8f7f3b067

Contents?: true

Size: 528 Bytes

Versions: 5

Compression:

Stored size: 528 Bytes

Contents

module Amakanize
  module Filters
    class TrailingAuthorNamePayloadDeletionFilter < BaseFilter
      PAYLOADS = %w(
        その他
        ほか
        他
        原作
        原案
        漫画
      )

      # @note Override
      # @param output [String] e.g. `"ハノカゲ ほか"`
      # @return [Hash] e.g. `"ハノカゲ"`
      def call(context:, output:)
        {
          context: context,
          output: output.gsub(/\s+#{::Regexp.union(PAYLOADS)}\z/, ""),
        }
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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