Sha256: e12ccedb5026151ca8086e9d777cf23632c5c88fa748cb96e5efd5d304cb4bce

Contents?: true

Size: 970 Bytes

Versions: 5

Compression:

Stored size: 970 Bytes

Contents

module Constants
  module Timeout
    MONGREL=45
  end
  module Wine
    PATH='/usr/bin/wine'
  end

  SUPPORTED_BROWSERS = %w(chrome firefox ie)
  
  SET_SELECTION=['ALPHA', 'NUMERIC', 'SPECIAL']
  

  alpha=%w(a b c d e f g h i j k l m n o p q r s t q u v w x y z Q W E R T Y U I O P A S D F G H J K L Z X C V B N M)
  numeric=%w(0 1 2 3 4 5 6 7 8 9)
  special=%w(~ ! @ # $ % ^ & * ( ) _ + ` _ + [ ] \ ; ' , . / { } | : " < > ?)
  
  SETS = {:alpha => alpha, :numeric => numeric, :special => special}
  
  # TODO, add options for speficying which sets to pull data from and
  # other filtering capabilities
  def self.rand_data(params={})
    # default 100 rand chars using all sets
    params[:length] ||= rand(100)
    params[:sets] ||= [:alpha, :numeric, :special]
    
    chars = []
    params[:length].times { |ct|
      set_key = params[:sets][rand(params[:sets].length)]
      set = SETS[set_key]
      chars << set[rand(set.length)]
    }
    chars
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
qa_robusta-0.1.9 common/lib/constants.rb
qa_robusta-0.1.8 common/lib/constants.rb
qa_robusta-0.1.5 common/lib/constants.rb
qa_robusta-0.1.4 common/lib/constants.rb
qa_robusta-0.1.3 common/lib/constants.rb