class ModelAuditor::Normalizers::String
Constants
- DEFAULTS
Attributes
options[R]
value[R]
Public Class Methods
new(value, options = {})
click to toggle source
# File lib/model_auditor/normalizers/string.rb, line 12 def initialize(value, options = {}) @value = value @options = DEFAULTS.merge options end
Public Instance Methods
normalize()
click to toggle source
# File lib/model_auditor/normalizers/string.rb, line 17 def normalize return value unless valid? value.truncate(limit) end
valid?()
click to toggle source
# File lib/model_auditor/normalizers/string.rb, line 23 def valid? value.present? && value.respond_to?(:truncate) end
Private Instance Methods
limit()
click to toggle source
# File lib/model_auditor/normalizers/string.rb, line 29 def limit options[:limit] end