Sha256: 2db4ce7f7849790a3788da498280e8e69e71d9d6534c2ac1626a4bd9f1e9270d

Contents?: true

Size: 655 Bytes

Versions: 6

Compression:

Stored size: 655 Bytes

Contents

require "amakanize/filters/base_filter"

module Amakanize
  module Filters
    class TrailingDoubleParenthesesSinglizationFilter < ::Amakanize::Filters::BaseFilter
      # @note Override
      # @param output [String] e.g. `"ヒナまつり 11 (ヒナまつり)  (ビームコミックス(ハルタ) )"`
      # @return [Hash] e.g. `"ヒナまつり 11 (ヒナまつり)  (ビームコミックスハルタ )"`
      def call(context:, output:)
        {
          context: context,
          output: output.sub(/\([^\(^\)]+?\([^\(]+?\)[^\)^\(]+?\)\z/) do
            "(" + $&.gsub(/[\(\)]/, "") + ")"
          end,
        }
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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