class Chadet::SecretCharacters

Attributes

chars_set[R]
max_hint[R]
num_of_chars[R]
secret_chars[RW]

Public Class Methods

new(chars_set, num_of_chars) click to toggle source

default chars = “0123456789” and default num = 4, see option parser.

# File lib/chadet.rb, line 198
def initialize chars_set, num_of_chars
  @num_of_chars = num_of_chars
  @chars_set = chars_set
  @secret_chars = do_shuffle
end

Public Instance Methods

do_shuffle() click to toggle source

Shuffle a set of number from 0-9

# File lib/chadet.rb, line 205
def do_shuffle
  prep_chars = @chars_set.chars.to_a.shuffle
  secret_chars = prep_chars[0, @num_of_chars].join.to_s
  return secret_chars
end