Class: MockServer::LoadPacing

Inherits:
Object
  • Object
show all
Defined in:
lib/mockserver/models.rb

Overview

Adaptive iteration pacing (think-time) for a load scenario: a target per-virtual-user iteration cycle time. mode is one of NONE, CONSTANT_PACING (+value+ is the target cycle in milliseconds) or CONSTANT_THROUGHPUT (+value+ is the target iterations/second per VU).

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mode:, value: nil) ⇒ LoadPacing

Returns a new instance of LoadPacing.



3061
3062
3063
3064
# File 'lib/mockserver/models.rb', line 3061

def initialize(mode:, value: nil)
  @mode = mode
  @value = value
end

Instance Attribute Details

#modeObject

Returns the value of attribute mode.



3059
3060
3061
# File 'lib/mockserver/models.rb', line 3059

def mode
  @mode
end

#valueObject

Returns the value of attribute value.



3059
3060
3061
# File 'lib/mockserver/models.rb', line 3059

def value
  @value
end

Class Method Details

.from_hash(data) ⇒ Object



3073
3074
3075
3076
3077
3078
3079
3080
# File 'lib/mockserver/models.rb', line 3073

def self.from_hash(data)
  return nil if data.nil?

  new(
    mode:  data['mode'],
    value: data['value']
  )
end

Instance Method Details

#to_hObject



3066
3067
3068
3069
3070
3071
# File 'lib/mockserver/models.rb', line 3066

def to_h
  MockServer.strip_none({
    'mode'  => @mode,
    'value' => @value
  })
end