Sha256: 26e48f72d4229f9581a346544fb7bf705918cf7e5761e7e32daf88484bd891bf

Contents?: true

Size: 718 Bytes

Versions: 7

Compression:

Stored size: 718 Bytes

Contents

# frozen_string_literal: true

require 'normalizy/filters'

module Normalizy
  class Config
    attr_accessor :default_filters
    attr_reader :filters, :normalizy_aliases

    def add(name, value)
      @filters[name] = value

      self
    end

    def alias(name, to)
      @normalizy_aliases[name] = to

      self
    end

    def initialize
      @default_filters   = {}
      @normalizy_aliases = {}

      @filters = {
        date:    Normalizy::Filters::Date,
        money:   Normalizy::Filters::Money,
        number:  Normalizy::Filters::Number,
        percent: Normalizy::Filters::Percent,
        slug:    Normalizy::Filters::Slug,
        strip:   Normalizy::Filters::Strip
      }
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
normalizy-1.6.0 lib/normalizy/config.rb
normalizy-1.5.0 lib/normalizy/config.rb
normalizy-1.4.0 lib/normalizy/config.rb
normalizy-1.3.0 lib/normalizy/config.rb
normalizy-1.2.0 lib/normalizy/config.rb
normalizy-1.1.1 lib/normalizy/config.rb
normalizy-1.1.0 lib/normalizy/config.rb