lib/jaspion/kilza.rb in jaspion-kilza-1.0.8 vs lib/jaspion/kilza.rb in jaspion-kilza-1.0.9
- old
+ new
@@ -26,19 +26,21 @@
#
# @param str [String] string to be cleaned
#
# @return [String] cleaned string
def self.clean(str)
+ return if str.nil?
str = '_' + str if str[0].number?
str.gsub(/[^a-zA-Z0-9]/, '_')
end
# Cleans the string and make it lowercase.
#
# @param str [String] string to be cleaned
#
# @return [String] cleaned string
def self.normalize(str)
+ return if str.nil?
Jaspion::Kilza.clean(str).downcase
end
end
end