Sha256: 5396ab13c0d30989d8f46c7e2fc369cbe7dd20317c6b1ab83a302f76361ac7f7
Contents?: true
Size: 639 Bytes
Versions: 72
Compression:
Stored size: 639 Bytes
Contents
class Agilibox::TokenGenerator attr_reader :options def initialize(options = {}) @options = options end def size options[:size] || self.class.default_size end def alphabet options[:alphabet] || self.class.default_alphabet end def call (alphabet * size).sample(size).join end class << self def call(*args) new(*args).call end attr_writer :default_size def default_size @default_size ||= 64 end attr_writer :default_alphabet def default_alphabet @default_alphabet ||= (0..9).to_a + ("a".."z").to_a + ("A".."Z").to_a end end # class << self end
Version data entries
72 entries across 72 versions & 1 rubygems