Sha256: 1b4bc4e497bac5ae7529cd2b7427bd5bff074916d3e1c9251a0cd2d634ce2532
Contents?: true
Size: 615 Bytes
Versions: 2
Compression:
Stored size: 615 Bytes
Contents
# Monkey patches for Object#blank?, Object.present? and String#pluralize # If active support is required, this won't be used, but # we shouldn't require a ruby project to use ActiveSupport # just for these three simple things module KeyUtility unless Object.respond_to?(:blank?) Object.class_eval do def blank? respond_to?(:empty?) ? empty? : !self end def present? !blank? end end end unless String.respond_to? :pluralize String.class_eval do def pluralize self[(self.length - 1), 1] =~ /s/i ? self : "#{self}s" end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
keytar-1.2.0 | lib/keytar/key_utility.rb |
keytar-1.1.0 | lib/keytar/key_utility.rb |