Sha256: a6b84f7ffc5b7b10337fef2e8324d89c4ad53db832c8f80e1b4b83b932bbe0b4

Contents?: true

Size: 859 Bytes

Versions: 2

Compression:

Stored size: 859 Bytes

Contents

module PageEz
  class Configuration
    VALID_MISMATCH_BEHAVIORS = [:warn, :raise, nil].freeze
    attr_accessor :logger
    attr_reader :on_pluralization_mismatch, :on_matcher_collision

    def initialize
      reset
    end

    def on_pluralization_mismatch=(value)
      if !VALID_MISMATCH_BEHAVIORS.include?(value)
        raise ArgumentError, "#{value.inspect} must be one of #{VALID_MISMATCH_BEHAVIORS}"
      end

      @on_pluralization_mismatch = value
    end

    def on_matcher_collision=(value)
      if !VALID_MISMATCH_BEHAVIORS.include?(value)
        raise ArgumentError, "#{value.inspect} must be one of #{VALID_MISMATCH_BEHAVIORS}"
      end

      @on_matcher_collision = value
    end

    def reset
      self.logger = NullLogger.new
      self.on_pluralization_mismatch = nil
      self.on_matcher_collision = :raise
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
page_ez-0.2.0 lib/page_ez/configuration.rb
page_ez-0.1.0 lib/page_ez/configuration.rb