lib/amakanize/author_name.rb in amakanize-0.5.3 vs lib/amakanize/author_name.rb in amakanize-0.6.0

- old
+ new

@@ -1,9 +1,11 @@ module Amakanize class AuthorName + include ::Amakanize::Filterable + class << self - # @return [Array<Class>] + # @note Override def filter_classes @filter_classes ||= [ ::Amakanize::Filters::HtmlUnescapeFilter, ::Amakanize::Filters::NormalizationFilter, ::Amakanize::Filters::HyphenMinusNormalizationFilter, @@ -11,26 +13,8 @@ ::Amakanize::Filters::RoleNameDeletionFilter, ::Amakanize::Filters::TrailingAuthorNamePayloadDeletionFilter, ::Amakanize::Filters::SpaceDeletionFilter, ] end - end - - # @param raw [String] - def initialize(raw) - @raw = raw - end - - # @note Override - def to_s - filters.inject(context: {}, output: @raw) do |result, filter| - filter.call(result) - end[:output] - end - - private - - def filters - @filters ||= self.class.filter_classes.map(&:new) end end end