Sha256: 9eea8980458e82a0b70134c3f1c6bb50e552fb27ed322aa3534eaf3da0f5a785

Contents?: true

Size: 675 Bytes

Versions: 2

Compression:

Stored size: 675 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,
        strip:   Normalizy::Filters::Strip
      }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
normalizy-1.0.1 lib/normalizy/config.rb
normalizy-1.0.0 lib/normalizy/config.rb