Sha256: 81d904982e582404575fd84033f9e536d27a5afec8ef6145479bf747227e90ed

Contents?: true

Size: 828 Bytes

Versions: 2

Compression:

Stored size: 828 Bytes

Contents

module Tagomatic

  class TagsProcessingChain

    def initialize(options, tags_processor_factory, logger)
      @options = options
      @tags_processor_factory = tags_processor_factory
      @logger = logger
    end

    def process!(tags_hash)
      return if tags_hash.nil? or tags_hash.empty?
      chain = create_processor_chain
      chain.each do |processor|
        tags_hash.merge! processor.process(tags_hash)
      end
    end

    protected

    def create_processor_chain
      chain = []
      chain << @tags_processor_factory.create_url_remover if @options[:removeurls]
      chain << @tags_processor_factory.create_tag_cleaner if @options[:cleantags]
      chain << @tags_processor_factory.create_tag_normalizer
      chain << @tags_processor_factory.create_tag_setter(@options)
      chain
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tagomatic-0.1.9 lib/tagomatic/tags_processing_chain.rb
tagomatic-0.1.8 lib/tagomatic/tags_processing_chain.rb