lib/pallets/util.rb in pallets-0.3.0 vs lib/pallets/util.rb in pallets-0.4.0
- old
+ new
@@ -1,10 +1,12 @@
module Pallets
module Util
extend self
- def camelize(str)
- str.to_s.gsub(/(?:^|_)([a-z])/) { $1.upcase }
+ def generate_id(str)
+ initials = str.gsub(/[^A-Z]+([A-Z])/, '\1')[0,3]
+ random = SecureRandom.hex(5)
+ "#{initials}#{random}"
end
def constantize(str)
names = str.split('::')