Class: VagrantPlugins::RsyncBlitz::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::RsyncBlitz::Config
- Defined in:
- lib/vagrant-rsync-blitz/config.rb
Instance Attribute Summary collapse
-
#autostart ⇒ Object
Returns the value of attribute autostart.
-
#latency ⇒ Object
Returns the value of attribute latency.
-
#time_format ⇒ Object
Returns the value of attribute time_format.
Instance Method Summary collapse
- #finalize! ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #validate(machine) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
10 11 12 13 14 |
# File 'lib/vagrant-rsync-blitz/config.rb', line 10 def initialize @autostart = UNSET_VALUE @latency = UNSET_VALUE @time_format = UNSET_VALUE end |
Instance Attribute Details
#autostart ⇒ Object
Returns the value of attribute autostart.
6 7 8 |
# File 'lib/vagrant-rsync-blitz/config.rb', line 6 def autostart @autostart end |
#latency ⇒ Object
Returns the value of attribute latency.
7 8 9 |
# File 'lib/vagrant-rsync-blitz/config.rb', line 7 def latency @latency end |
#time_format ⇒ Object
Returns the value of attribute time_format.
8 9 10 |
# File 'lib/vagrant-rsync-blitz/config.rb', line 8 def time_format @time_format end |
Instance Method Details
#finalize! ⇒ Object
16 17 18 19 20 |
# File 'lib/vagrant-rsync-blitz/config.rb', line 16 def finalize! @autostart = false if @autostart == UNSET_VALUE @latency = 2.0 if @latency == UNSET_VALUE @time_format = "%I:%M:%S %p" if @time_format == UNSET_VALUE end |
#validate(machine) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/vagrant-rsync-blitz/config.rb', line 22 def validate(machine) errors = _detected_errors if @latency == UNSET_VALUE return elsif not @latency.is_a? Numeric @latency = 2.0 errors << "Latency must be a number, setting to 2.0" elsif @latency < 0.2 @latency = 0.2 errors << "Latency must not be too low, setting to 0.2 seconds" end { "blitz" => errors } end |