Class: GoogleSslCert::Name

Inherits:
Object
  • Object
show all
Extended by:
Memoist
Defined in:
lib/google_ssl_cert/name.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Name

Returns a new instance of Name.



5
6
7
8
# File 'lib/google_ssl_cert/name.rb', line 5

def initialize(options={})
  @options = options
  @append_type = @options[:append_type].nil? ? true : @options[:append_type]
end

Instance Method Details

#base_nameObject



16
17
18
19
# File 'lib/google_ssl_cert/name.rb', line 16

def base_name
  type = @options[:global] ? "global" : ENV['GOOGLE_REGION'] if @append_type
  [@options[:cert_name], type].compact.join('-')
end

#generated_nameObject



10
11
12
13
# File 'lib/google_ssl_cert/name.rb', line 10

def generated_name
  ts = Time.now.strftime("%Y%m%d%H%M%S") unless @options[:timestamp] == false # nil defaults to true
  [base_name, ts].compact.join('-')
end