Sha256: f30275ce28587ee430ba179804c48c8fa4f78250ab9b234625b71115b2b0f7c6

Contents?: true

Size: 633 Bytes

Versions: 16

Compression:

Stored size: 633 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_Z0_9 = (('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a)
      a_zA_Z0_9.sample(n).join
    end
  end # of class methods
end

module Kumogata
  ENCRYPTION_PASSWORD = Kumogata::Utils.random_param_name(16)
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
kumogata-0.4.4 lib/kumogata/utils.rb
kumogata-0.4.3 lib/kumogata/utils.rb
kumogata-0.4.2 lib/kumogata/utils.rb
kumogata-0.4.1 lib/kumogata/utils.rb
kumogata-0.4.0 lib/kumogata/utils.rb
kumogata-0.3.14 lib/kumogata/utils.rb
kumogata-0.3.13 lib/kumogata/utils.rb
kumogata-0.3.12 lib/kumogata/utils.rb
kumogata-0.3.11 lib/kumogata/utils.rb
kumogata-0.3.10 lib/kumogata/utils.rb
kumogata-0.3.9 lib/kumogata/utils.rb
kumogata-0.3.8 lib/kumogata/utils.rb
kumogata-0.3.7 lib/kumogata/utils.rb
kumogata-0.3.6 lib/kumogata/utils.rb
kumogata-0.3.5 lib/kumogata/utils.rb
kumogata-0.3.4 lib/kumogata/utils.rb