Sha256: 8ced34cf6f0ae5036f7e934232f6c929e78b614787cdcfcd5c8d98386ad4c229

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

# encoding: UTF-8

module Rosette
  module Core

    # Logic for handling preprocessor ids. Preprocessor ids are strings that
    # refer to a particular preprocessor class. For example, the id
    # 'normalization' refers to
    # +Rosette::Preprocessors::NormalizationPreprocessor+.
    #
    # @example
    #   PreprocessorId.resolve('normalization')
    #   # => Rosette::Preprocessors::NormalizationPreprocessor
    class PreprocessorId < Resolver
      class << self

        # Parses and identifies the class constant for the given preprocessor id.
        #
        # @param [Class, String] preprocessor_id When given a class, returns the
        #   class. When given a string, parses and identifies the corresponding
        #   class constant in +namespace+.
        # @param [Class] namespace The namespace to look in.
        # @return [Class] The identified class constant.
        def resolve(preprocessor_id, namespace = Rosette::Preprocessors)
          super
        end

        private

        def suffix
          'Preprocessor'
        end

      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rosette-core-1.0.1 lib/rosette/core/resolvers/preprocessor_id.rb