Class: VpnChoice::AttachmentExecution

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-skytap/api/vpn.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env, vpn, iface, attachment = nil) ⇒ AttachmentExecution

Returns a new instance of AttachmentExecution.


60
61
62
63
64
65
# File 'lib/vagrant-skytap/api/vpn.rb', line 60

def initialize(env, vpn, iface, attachment=nil)
  @env = env
  @vpn = vpn
  @iface = iface
  @attachment = attachment
end

Instance Attribute Details

#attachmentObject (readonly)

Returns the value of attribute attachment


46
47
48
# File 'lib/vagrant-skytap/api/vpn.rb', line 46

def attachment
  @attachment
end

#envObject (readonly)

Returns the value of attribute env


46
47
48
# File 'lib/vagrant-skytap/api/vpn.rb', line 46

def env
  @env
end

#ifaceObject (readonly)

Returns the value of attribute iface


46
47
48
# File 'lib/vagrant-skytap/api/vpn.rb', line 46

def iface
  @iface
end

#vpnObject (readonly)

Returns the value of attribute vpn


46
47
48
# File 'lib/vagrant-skytap/api/vpn.rb', line 46

def vpn
  @vpn
end

Class Method Details

.make(env, vpn, iface) ⇒ Object


48
49
50
51
52
53
54
55
56
57
58
# File 'lib/vagrant-skytap/api/vpn.rb', line 48

def self.make(env, vpn, iface)
  attachment = iface.attachment_for(vpn)

  if attachment.try(:connected?)
    UseAttachmentExecution.new(env, vpn, iface, attachment)
  elsif attachment
    ConnectAttachmentExecution.new(env, vpn, iface, attachment)
  else
    CreateAttachmentExecution.new(env, vpn, iface)
  end
end

Instance Method Details

#executeObject

Raises:

  • (NotImplementedError)

71
72
73
# File 'lib/vagrant-skytap/api/vpn.rb', line 71

def execute
  raise NotImplementedError.new('Must override')
end

#verbObject

Raises:

  • (NotImplementedError)

67
68
69
# File 'lib/vagrant-skytap/api/vpn.rb', line 67

def verb
  raise NotImplementedError.new('Must override')
end