Sha256: c714e3d8e10729e8ccea3f88e113dc541ffe74cd3364d33cf8d9d7c97f7a713d

Contents?: true

Size: 509 Bytes

Versions: 1

Compression:

Stored size: 509 Bytes

Contents

# frozen_string_literal: true
require 'active_model'
require 'unicode-tools'
require 'autostrip/extension'

module Autostrip
  class << self
    def perform(value)
      value.squish.trim
    end

    def performable?(value)
      value.kind_of?(String)
    end
  end
end

module ActiveModel::Validations::HelperMethods
  include Autostrip::Extension
end

if defined?(ActiveRecord::Base) && !ActiveRecord::Base.methods.include?(:autostrip)
  class ActiveRecord::Base
    extend Autostrip::Extension
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
autostrip-1.0.2 lib/autostrip.rb