Class: PublicIpChoice
Overview
TODO:NLA Move this to another class, properly namespaced.
Defined Under Namespace
Classes: AttachAndUseExecution, AttachmentExecution, UseAttachmentExecution
Instance Attribute Summary collapse
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#execution ⇒ Object
readonly
Returns the value of attribute execution.
-
#iface ⇒ Object
readonly
Returns the value of attribute iface.
-
#ip ⇒ Object
readonly
Returns the value of attribute ip.
Instance Method Summary collapse
- #choose ⇒ Object
-
#initialize(env, ip, iface) ⇒ PublicIpChoice
constructor
A new instance of PublicIpChoice.
- #to_s ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(env, ip, iface) ⇒ PublicIpChoice
Returns a new instance of PublicIpChoice.
7 8 9 10 11 12 |
# File 'lib/vagrant-skytap/api/public_ip.rb', line 7 def initialize(env, ip, iface) @env = env @ip = ip @iface = iface @execution = AttachmentExecution.make(env, ip, iface) end |
Instance Attribute Details
#env ⇒ Object (readonly)
Returns the value of attribute env.
5 6 7 |
# File 'lib/vagrant-skytap/api/public_ip.rb', line 5 def env @env end |
#execution ⇒ Object (readonly)
Returns the value of attribute execution.
5 6 7 |
# File 'lib/vagrant-skytap/api/public_ip.rb', line 5 def execution @execution end |
#iface ⇒ Object (readonly)
Returns the value of attribute iface.
5 6 7 |
# File 'lib/vagrant-skytap/api/public_ip.rb', line 5 def iface @iface end |
#ip ⇒ Object (readonly)
Returns the value of attribute ip.
5 6 7 |
# File 'lib/vagrant-skytap/api/public_ip.rb', line 5 def ip @ip end |
Instance Method Details
#choose ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/vagrant-skytap/api/public_ip.rb', line 24 def choose execution.execute host = ip.address port = 22 #TODO:NLA Use constant. [host, port] end |
#to_s ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/vagrant-skytap/api/public_ip.rb', line 14 def to_s "#{execution.verb} public IP: #{ip.address}".tap do |ret| if ip.deployed? ret << ' (attached and deployed to another VM)' elsif ip.attached? ret << ' (attached to another VM)' end end end |
#valid? ⇒ Boolean
32 33 34 |
# File 'lib/vagrant-skytap/api/public_ip.rb', line 32 def valid? true end |