Class: VagrantPlugins::GatlingRsync::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-gatling-rsync/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



8
9
10
# File 'lib/vagrant-gatling-rsync/config.rb', line 8

def initialize
  @latency = UNSET_VALUE
end

Instance Attribute Details

#latencyObject

Returns the value of attribute latency.



6
7
8
# File 'lib/vagrant-gatling-rsync/config.rb', line 6

def latency
  @latency
end

Instance Method Details

#finalize!Object



12
13
14
# File 'lib/vagrant-gatling-rsync/config.rb', line 12

def finalize!
  @latency = 1.5 if @latency == UNSET_VALUE
end

#validate(machine) ⇒ Object

@TODO: This does not appear to be called.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/vagrant-gatling-rsync/config.rb', line 17

def validate(machine)
  errors = _detected_errors

  if @latency == UNSET_VALUE
    return
  elsif not @latency.is_a? Numeric
    @latency = 1.5
    # @TODO: Translate.
    errors << "The latency must be set to a number. Substituting 1.5 as a value."
  elsif @latency < 0.2
    @latency = 0.2
    # @TODO: Translate.
    errors << "The latency may not be below 0.2 seconds."
  end

  { "gatling" => errors }
end