class RTsung::Phase

Constants

OPTIONS
PHASE_DURATION
PHASE_UNIT
USERS_UNIT

Public Class Methods

new(name = 1, duration = nil, unit = nil, options = {}) click to toggle source
# File lib/rtsung/phase.rb, line 10
def initialize(name = 1, duration = nil, unit = nil, options = {})
  @attrs = {
    :phase => name,
    :duration => duration || PHASE_DURATION,
    :unit => unit || PHASE_UNIT
  }

  options = OPTIONS if options.empty?

  if options[:rate]
    @users = {
      :arrivalrate => options[:rate],
      :unit => options[:unit] || USERS_UNIT
    }
  else
    @users = {
      :interarrival => options[:interval],
      :unit => options[:unit] || USERS_UNIT
    }
  end
end

Public Instance Methods

to_xml(xml) click to toggle source
# File lib/rtsung/phase.rb, line 32
def to_xml(xml)
  xml.arrivalphase(@attrs) do
    xml.users @users
  end
end