lib/sugar-high/string.rb in sugar-high-0.6.2.1 vs lib/sugar-high/string.rb in sugar-high-0.6.3
- old
+ new
@@ -8,23 +8,20 @@
def self.letters type = :lower
letters = ('a'..'z').to_a
type == :upper ? letters.map!(&:upcase) : letters
end
- unless "".respond_to? :trim
- def trim
- self.strip
- end
- end
+ def trim
+ self.strip
+ end unless "".respond_to? :trim
- unless "".respond_to? :concats
- def concats *args
- args.inject(self) do |res, arg|
- res << arg.to_s
- res
- end
+
+ def concats *args
+ args.inject(self) do |res, arg|
+ res << arg.to_s
+ res
end
- end
+ end unless "".respond_to? :concats
# remove prefixed '-' signs, then allow any letter, number, underscore '_' or dash '-'
def alpha_numeric
self.gsub(/^\-+/, '').gsub(/[^0-9a-zA-Z_\-]+/i, '')
end