Sha256: 247bf0d2da4baf7ffb88f6b1063f5f1f4ab0035af634dc8a8eff48219fbcb75d

Contents?: true

Size: 520 Bytes

Versions: 2

Compression:

Stored size: 520 Bytes

Contents

module TextCaptcha
  module ActionHelper
    def rand_question
      question = "What is "
      operands = [rand(10),rand(10)]
      operators = ['+','-','*']
      operator = operators.choice
      case operator
      when '+'
        result = operands.max + operands.min
      when '-'
        result = operands.max - operands.min
      when '*'
        result = operands.max * operands.min
      end

      question << " #{operands.max} #{operator} #{operands.min} = "
      return question,result
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
webroar-0.7.0 src/admin_panel/vendor/plugins/text_captcha/lib/text_captcha/action_helper.rb
webroar-0.6.1 src/admin_panel/vendor/plugins/text_captcha/lib/text_captcha/action_helper.rb