Sha256: ef11533f74cccf1498863129033d72393167b58a102e75a407b2444402c32e4e
Contents?: true
Size: 699 Bytes
Versions: 2
Compression:
Stored size: 699 Bytes
Contents
# frozen_string_literal: true require 'time' require_relative 'monkey_action' require_relative 'monkey_timed_action' require 'MonkeyEngine/exceptions' # Monkey action: sleep (as in take a snooze) # The monkey is a sleep. class MonkeyActionSleep < MonkeyTimedAction WEIGHT = 10.0 VALID_VALUES = ((60 * 6)..(60 * 8)) # 6 through 8 hours def initialize(monkey, value) super monkey, value, WEIGHT @action_time_of_completion = @action_time + (value * (60 * 60)) 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_sleep.rb |
MonkeyEngine-2.0.1 | lib/MonkeyAction/monkey_action_sleep.rb |