Sha256: 44b8ead661d16a9e1672245cd83adb711bdf13067108970fbc885eb06c59426f
Contents?: true
Size: 877 Bytes
Versions: 2
Compression:
Stored size: 877 Bytes
Contents
module Amakanize module Filters class RoleNameDeletionFilter < 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(%r<\A\(#{PATTERN_OF_ROLE_NAME}(?:・#{PATTERN_OF_ROLE_NAME})*\)>, "") .gsub(%r<\(#{PATTERN_OF_ROLE_NAME}(?:・#{PATTERN_OF_ROLE_NAME})*\)\z>, ""), } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
amakanize-0.5.1 | lib/amakanize/filters/role_name_deletion_filter.rb |
amakanize-0.5.0 | lib/amakanize/filters/role_name_deletion_filter.rb |