Class: Nydp::Builtin::RandomString

Inherits:
Object
  • Object
show all
Includes:
Base, Singleton
Defined in:
lib/nydp/builtin/random_string.rb

Constant Summary collapse

RANDOM_CHARS =
["A","B","C","D","E","F","G","H","J","K","L","M","N","P","Q","R","S","T","U","V","W","X","Y","Z","2","3","4","5","6","7","8","9"]

Instance Method Summary collapse

Methods included from Base

#call, #handle_error, ignore_errors, #inspect, #name, #nydp_type, #to_s

Methods included from Helper

#cons, #list, #literal?, #pair?, #sig, #sym, #sym?

Methods included from Converter

#n2r, #r2n, #rubify

Instance Method Details

#builtin_call(length = nil) ⇒ Object



6
7
8
# File 'lib/nydp/builtin/random_string.rb', line 6

def builtin_call length=nil
  (0...(length || 10)).inject("") {|a,i| a << RANDOM_CHARS[rand(RANDOM_CHARS.size)] }
end