Sha256: 87ffc2666f5394fe9757dacce33883bcc2d3da62aa8e80041f34951879d96d71
Contents?: true
Size: 936 Bytes
Versions: 6
Compression:
Stored size: 936 Bytes
Contents
require "amakanize/filters/base_filter" module Amakanize module Filters class RoleNameDeletionFilter < ::Amakanize::Filters::BaseFilter PATTERN_OF_ROLE_NAME = ::Regexp.union( %w( イラスト カバーデザイン キャラクター原案 原作 原案 漫画 ) ) # @note Override # @param output [String] e.g. `"漫画:ハノカゲ"`, `"ハノカゲ:漫画"` # @return [Hash] e.g. `"ハノカゲ"` def call(context:, output:) { context: context, output: output .gsub(%r<\A#{PATTERN_OF_ROLE_NAME}[:/]>, "") .gsub(%r<[:/]#{PATTERN_OF_ROLE_NAME}\z>, "") .gsub(/\A\(#{PATTERN_OF_ROLE_NAME}(?:・#{PATTERN_OF_ROLE_NAME})*\)/, "") .gsub(/\(#{PATTERN_OF_ROLE_NAME}(?:・#{PATTERN_OF_ROLE_NAME})*\)\z/, ""), } end end end end
Version data entries
6 entries across 6 versions & 1 rubygems