Sha256: bb676312b5b445c13642d398f177ff5881c6323e6d628e42bd6dbed0b84f8dc6
Contents?: true
Size: 489 Bytes
Versions: 1
Compression:
Stored size: 489 Bytes
Contents
require 'dm-core' module DataMapper module Trimmer def self.included(base) base.class_eval do alias_method :set_without_trimmer!, :set! alias_method :set!, :set_with_trimmer! end end def set_with_trimmer!(name, value) value = value.strip if value.respond_to?(:strip) value = nil if value.respond_to?(:empty?) && value.empty? set_without_trimmer!(name, value) end end Property.send(:include, Trimmer) end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dm-trimmer-0.1.0 | lib/dm-trimmer/trimmer.rb |