Sha256: 2d5be956b59792bd83ace0bad424d554048fd8130b2f97a0d7505428f9b08bc5

Contents?: true

Size: 692 Bytes

Versions: 1

Compression:

Stored size: 692 Bytes

Contents

# frozen_string_literal: true

require 'normalizy/filters'

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

    def add(name, value, raw: false)
      @filters[name] = value
      @normalizy_raws << name if raw

      self
    end

    def alias(name, to, raw: false)
      @normalizy_aliases[name] = to
      @normalizy_raws << name if raw

      self
    end

    def initialize
      @default_filters   = {}
      @normalizy_aliases = {}
      @normalizy_raws    = [:number]

      @filters = {
        number: Normalizy::Filters::Number,
        strip:  Normalizy::Filters::Strip
      }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
normalizy-0.1.0 lib/normalizy/config.rb