class P3libUtil
library for all helper classes
Public Class Methods
decode_args(args)
click to toggle source
base64 decode all strings in list
# File lib/refx/engine/p3lib/p3lib_util.rb, line 14 def self.decode_args(args) decoded = [] args.each do | arg | if arg.is_a?(String) decoded << Base64.decode64(arg) else decoded << arg end end decoded end
force_utf(args)
click to toggle source
force all strings to utf in list
# File lib/refx/engine/p3lib/p3lib_util.rb, line 28 def self.force_utf(args) forced = [] args.each do | arg | if arg.is_a?(String) arg.force_encoding('UTF-8') end forced << arg end forced end
helper_newtempname(len)
click to toggle source
# File lib/refx/engine/p3lib/p3lib_util.rb, line 6 def self.helper_newtempname(len) chars = ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a newpass = '' 1.upto(len) { |i| newpass << chars[rand(chars.size-1)] } return newpass end