Sha256: b6d8d2d8231471d7f0a8cef7b626ca4d9a6568a3775d994cd2f15b349a1ab77b

Contents?: true

Size: 771 Bytes

Versions: 9

Compression:

Stored size: 771 Bytes

Contents

module Amakanize
  class AuthorName
    class << self
      # @return [Array<Amakan::Filters::BaseFilter>]
      def filters
        @filters ||= [
          ::Amakanize::Filters::HtmlUnescapeFilter.new,
          ::Amakanize::Filters::NormalizationFilter.new,
          ::Amakanize::Filters::ParenthesesDeletionFilter.new,
          ::Amakanize::Filters::RoleNameDeletionFilter.new,
          ::Amakanize::Filters::TrailingAuthorNamePayloadDeletionFilter.new,
          ::Amakanize::Filters::SpaceDeletionFilter.new,
        ]
      end
    end

    # @param raw [String]
    def initialize(raw)
      @raw = raw
    end

    # @note Override
    def to_s
      self.class.filters.inject(@raw) do |result, filter|
        filter.call(result)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
amakanize-0.1.8 lib/amakanize/author_name.rb
amakanize-0.1.7 lib/amakanize/author_name.rb
amakanize-0.1.6 lib/amakanize/author_name.rb
amakanize-0.1.5 lib/amakanize/author_name.rb
amakanize-0.1.4 lib/amakanize/author_name.rb
amakanize-0.1.3 lib/amakanize/author_name.rb
amakanize-0.1.2 lib/amakanize/author_name.rb
amakanize-0.1.1 lib/amakanize/author_name.rb
amakanize-0.1.0 lib/amakanize/author_name.rb