Class: Cyoi::Cli::Providers::ProviderCli

Inherits:
Object
  • Object
show all
Defined in:
lib/cyoi/cli/providers/provider_cli.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes, highline) ⇒ ProviderCli

Returns a new instance of ProviderCli.



7
8
9
10
11
# File 'lib/cyoi/cli/providers/provider_cli.rb', line 7

def initialize(attributes, highline)
  @hl = highline
  @attributes = attributes.is_a?(Hash) ? ReadWriteSettings.new(attributes) : attributes
  raise "@attributes must be ReadWriteSettings (or Hash)" unless @attributes.is_a?(ReadWriteSettings)
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



4
5
6
# File 'lib/cyoi/cli/providers/provider_cli.rb', line 4

def attributes
  @attributes
end

#hlObject (readonly)

Returns the value of attribute hl.



5
6
7
# File 'lib/cyoi/cli/providers/provider_cli.rb', line 5

def hl
  @hl
end

Instance Method Details

#display_confirmationObject



25
26
27
# File 'lib/cyoi/cli/providers/provider_cli.rb', line 25

def display_confirmation
  raise "please implement in subclass"
end

#export_attributesObject

helper to export the complete nested attributes.



14
15
16
# File 'lib/cyoi/cli/providers/provider_cli.rb', line 14

def export_attributes
  attributes.to_nested_hash
end

#say(message, *args) ⇒ Object



29
30
31
# File 'lib/cyoi/cli/providers/provider_cli.rb', line 29

def say(message, *args)
  puts(message)
end

#valid_infrastructure?Boolean

Only a subclass can represent valid infrastruct If using this class directly, then it has not yet decided which provider/infrastructure to use

Returns:

  • (Boolean)


21
22
23
# File 'lib/cyoi/cli/providers/provider_cli.rb', line 21

def valid_infrastructure?
  false
end