lib/ohm/slug.rb in ohm-contrib-2.0.0.alpha5 vs lib/ohm/slug.rb in ohm-contrib-2.0.0.rc1
- old
+ new
@@ -9,15 +9,16 @@
super(id.to_i)
end
end
def slug(str = to_s)
- ret = transcode(str)
+ ret = transcode(str.dup)
ret.gsub!("'", "")
ret.gsub!(/[^0-9A-Za-z]/u, " ")
ret.strip!
ret.gsub!(/\s+/, "-")
- ret.downcase
+ ret.downcase!
+ return ret
end
module_function :slug
def transcode(str)
begin