class Cyoi::Cli::Image::ImageCliBase

Attributes

attributes[R]
hl[R]
provider_client[R]

Public Class Methods

new(provider_client, attributes, highline) click to toggle source
# File lib/cyoi/cli/provider_image/image_cli_base.rb, line 7
def initialize(provider_client, attributes, highline)
  @provider_client = provider_client
  @hl = highline
  @attributes = attributes.is_a?(Hash) ? ReadWriteSettings.new(attributes) : attributes
  raise "@attributes must be ReadWriteSettings (or Hash); was #{@attributes.class}" unless @attributes.is_a?(ReadWriteSettings)
end

Public Instance Methods

display_confirmation() click to toggle source
# File lib/cyoi/cli/provider_image/image_cli_base.rb, line 30
def display_confirmation
  puts "\n"
  puts "Confirming: Using image #{attributes["image_id"]}"
end
export_attributes() click to toggle source

helper to export the complete nested attributes.

# File lib/cyoi/cli/provider_image/image_cli_base.rb, line 22
def export_attributes
  attributes.to_nested_hash
end
perform_and_return_attributes() click to toggle source
# File lib/cyoi/cli/provider_image/image_cli_base.rb, line 14
def perform_and_return_attributes
  unless valid?
    attributes["image_id"] = image_id
  end
  export_attributes
end
valid?() click to toggle source
# File lib/cyoi/cli/provider_image/image_cli_base.rb, line 26
def valid?
  attributes["image_id"]
end