Sha256: 5adcbf2aac3e3a8129bf35cc09a8c286b0fd8401224eb18ff392a76825ec7cf6
Contents?: true
Size: 559 Bytes
Versions: 2
Compression:
Stored size: 559 Bytes
Contents
# frozen_string_literal: true module ModelAuditor module Normalizers class String attr_reader :value, :options DEFAULTS = { limit: 97 }.freeze def initialize(value, options = {}) @value = value @options = DEFAULTS.merge options end def normalize return value unless valid? value.truncate(limit) end def valid? value.present? && value.respond_to?(:truncate) end private def limit options[:limit] end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
model_auditor-0.0.2 | lib/model_auditor/normalizers/string.rb |
model_auditor-0.0.1 | lib/model_auditor/normalizers/string.rb |