Sha256: 0fe12f976a696664dcb7e4c95366efb24ad7612fe2abe828479ebe5d6935d4fe

Contents?: true

Size: 365 Bytes

Versions: 4

Compression:

Stored size: 365 Bytes

Contents

# frozen_string_literal: true

module ActsAsStrippableOn
  module Core
    def acts_as_strippable_on(*attributes)
      before_validation do
        attributes.each do |attribute|
          next if send(attribute).blank? || !send(attribute).respond_to?(:strip)
          assign_attributes(attribute => send(attribute).strip)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
acts_as_strippable_on-0.2.3 lib/acts_as_strippable_on/core.rb
acts_as_strippable_on-0.2.2 lib/acts_as_strippable_on/core.rb
acts_as_strippable_on-0.2.1 lib/acts_as_strippable_on/core.rb
acts_as_strippable_on-0.2.0 lib/acts_as_strippable_on/core.rb