Sha256: d5136fba0a417a59d04d8f352678407b05fb75bad1faade7d9fa4dc2ed4e9623
Contents?: true
Size: 694 Bytes
Versions: 2
Compression:
Stored size: 694 Bytes
Contents
# frozen_string_literal: true require 'time' require_relative 'monkey_action' require_relative 'monkey_timed_action' require 'MonkeyEngine/exceptions' # Monkey action: pause (as in take a break) # The monkey paused, usually from typing. class MonkeyActionPause < MonkeyTimedAction WEIGHT = 2.0 VALID_VALUES = (0..60) # Seconds (0 - 60 seconds) def initialize(monkey, value) super monkey, value, WEIGHT @action_time_of_completion = @action_time + value validate end protected def validate super raise MonkeyEngine::Exceptions::InvalidArgumentValueException, "Value '#{value}' is not a valid value" \ unless VALID_VALUES.include?(@value) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
MonkeyEngine-2.0.2 | lib/MonkeyAction/monkey_action_pause.rb |
MonkeyEngine-2.0.1 | lib/MonkeyAction/monkey_action_pause.rb |