class Drntest::SubscribeUntil
Constants
- DEFAULT_TIMEOUT_SECONDS
- ONE_HOUR_IN_SECONDS
- ONE_MINUTE_IN_SECONDS
Attributes
max_messages[R]
timeout_seconds[R]
Public Class Methods
new(parameters)
click to toggle source
# File lib/drntest/directive.rb, line 79 def initialize(parameters) @max_messages = nil @timeout_seconds = nil parameters.each do |parameter| case parameter when /\A(\d+)(?:messages|msg)?\z/ @max_messages = $1.to_i when /\A(\d+\.?|\.\d+|\d+\.\d+)s(?:ec(?:onds?)?)?\z/ @timeout_seconds = $1.to_f when /\A(\d+\.?|\.\d+|\d+\.\d+)m(?:inutes?)?\z/ @timeout_seconds = $1.to_f * ONE_MINUTE_IN_SECONDS when /\A(\d+\.?|\.\d+|\d+\.\d+)h(?:ours?)?\z/ @timeout_seconds = $1.to_f * ONE_HOUR_IN_SECONDS end end if @max_messages.nil? and @timeout_seconds.nil? @timeout_seconds = DEFAULT_TIMEOUT_SECONDS end end