Sha256: e16f35c666fea65dd39fa5ddc0fd8203b5768b1b6ff3d83f75b3cdd55b353634

Contents?: true

Size: 591 Bytes

Versions: 6

Compression:

Stored size: 591 Bytes

Contents

require "amakanize/filters/base_filter"

module Amakanize
  module Filters
    class TrailingAuthorNamePayloadDeletionFilter < ::Amakanize::Filters::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

6 entries across 6 versions & 1 rubygems

Version Path
amakanize-0.7.0 lib/amakanize/filters/trailing_author_name_payload_deletion_filter.rb
amakanize-0.6.5 lib/amakanize/filters/trailing_author_name_payload_deletion_filter.rb
amakanize-0.6.4 lib/amakanize/filters/trailing_author_name_payload_deletion_filter.rb
amakanize-0.6.3 lib/amakanize/filters/trailing_author_name_payload_deletion_filter.rb
amakanize-0.6.2 lib/amakanize/filters/trailing_author_name_payload_deletion_filter.rb
amakanize-0.6.1 lib/amakanize/filters/trailing_author_name_payload_deletion_filter.rb