Sha256: 772dd034c302aac2746a3a70580515b45fa73c00dca0b03db9d5a70024d738b4
Contents?: true
Size: 913 Bytes
Versions: 6
Compression:
Stored size: 913 Bytes
Contents
require "amakanize/filters/base_filter" module Amakanize module Filters class TrailingVolumeNumberDeletionFilter < ::Amakanize::Filters::BaseFilter # @note Override # @param output [String] e.g. `"やはり俺の青春ラブコメはまちがっている。4"`, `"ネトゲの嫁は女の子じゃないと思った? Lv.2"` # @return [Hash] e.g. `"やはり俺の青春ラブコメはまちがっている。"`, `"ネトゲの嫁は女の子じゃないと思った?"` def call(context:, output:) if !context[:volume_number_removed] && !output.match(/[^\s]Lv\.?\s*#{Amakanize::PATTERN_OF_NUMERIC_CHARACTERS}\z/i) output = output.sub(/,?\s*#{PATTERN_OF_VOLUME_PREFIX}?#{Amakanize::PATTERN_OF_NUMERIC_CHARACTERS}(?:話|巻|版)?(?:\s*\(.*?\))?\z/, "") end { context: context, output: output, } end end end end
Version data entries
6 entries across 6 versions & 1 rubygems