Class: DevboxLauncher::Description
- Inherits:
-
Object
- Object
- DevboxLauncher::Description
- Defined in:
- lib/devbox_launcher/models/description.rb
Instance Method Summary collapse
-
#initialize(yaml) ⇒ Description
constructor
A new instance of Description.
- #ip ⇒ Object
- #network_interfaces ⇒ Object
- #running? ⇒ Boolean
- #status ⇒ Object
Constructor Details
#initialize(yaml) ⇒ Description
Returns a new instance of Description.
4 5 6 |
# File 'lib/devbox_launcher/models/description.rb', line 4 def initialize(yaml) @desc = YAML.load(yaml) end |
Instance Method Details
#ip ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/devbox_launcher/models/description.rb', line 8 def ip return @ip if @ip network_interface = network_interfaces.first access_configs = network_interface["accessConfigs"] access_config = access_configs.find do |c| c["kind"] == "compute#accessConfig" end @ip = access_config["natIP"] end |
#network_interfaces ⇒ Object
23 24 25 |
# File 'lib/devbox_launcher/models/description.rb', line 23 def network_interfaces @network_interfaces ||= @desc["networkInterfaces"] end |
#running? ⇒ Boolean
27 28 29 |
# File 'lib/devbox_launcher/models/description.rb', line 27 def running? status == "RUNNING" end |
#status ⇒ Object
19 20 21 |
# File 'lib/devbox_launcher/models/description.rb', line 19 def status @status ||= @desc["status"] end |