Class: Vagrant::Serial::Config

Inherits:
Config::Base
  • Object
show all
Defined in:
lib/vagrant-serial/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#forward_com1Object

Returns the value of attribute forward_com1.



4
5
6
# File 'lib/vagrant-serial/config.rb', line 4

def forward_com1
  @forward_com1
end

#forward_com2Object

Returns the value of attribute forward_com2.



5
6
7
# File 'lib/vagrant-serial/config.rb', line 5

def forward_com2
  @forward_com2
end

#sockets_pathObject

Returns the value of attribute sockets_path.



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

def sockets_path
  @sockets_path
end

Instance Method Details

#set?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/vagrant-serial/config.rb', line 13

def set?
  forward_com1 || forward_com2
end

#validate(env, errors) ⇒ Object



17
18
19
20
21
22
# File 'lib/vagrant-serial/config.rb', line 17

def validate(env, errors)
  return unless set?

  errors.add("Host port for com1 forwarding couldn't be below 1024.") if forward_com1 && forward_com1.to_i < 1024
  errors.add("Host port for com2 forwarding couldn't be below 1024.") if forward_com2 && forward_com2.to_i < 1024
end