Sha256: 9ee8ada160759323a1f9295acde454484e7a3a0d37e9242aa20f48300b345a7e
Contents?: true
Size: 644 Bytes
Versions: 3
Compression:
Stored size: 644 Bytes
Contents
class Kumogata::Utils class << self def camelize(str) str.to_s.split(/[-_]/).map {|i| i[0, 1].upcase + i[1..-1].downcase }.join end def get_user_host user = `whoami`.strip rescue '' host = `hostname`.strip rescue '' user_host = [user, host].select {|i| not i.empty? }.join('-') user_host.empty? ? nil : user_host end def random_param_name(n) a_zA_Z = (('a'..'z').to_a + ('A'..'Z').to_a) (a_zA_Z.sample(1) + (a_zA_Z + ['-']).sample(n - 1)).join end end # of class methods end module Kumogata ENCRYPTION_PASSWORD = Kumogata::Utils.random_param_name(16) end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
kumogata-0.3.3 | lib/kumogata/utils.rb |
kumogata-0.3.2 | lib/kumogata/utils.rb |
kumogata-0.3.1 | lib/kumogata/utils.rb |