Class: AwsConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/aws_config.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ AwsConfig

Returns a new instance of AwsConfig.



4
5
6
# File 'lib/aws_config.rb', line 4

def initialize(opts={})
  @opts = opts
end

Class Method Details

.load(file) ⇒ Object



32
33
34
35
# File 'lib/aws_config.rb', line 32

def self.load(file)
  config_opts = File.exist?(file) ? YAML.load_file(file) : {}
  AwsConfig.new(config_opts)
end

.write(file) ⇒ Object



41
42
43
# File 'lib/aws_config.rb', line 41

def self.write(file)
  FileUtils.cp(File.expand_path('../opts.yml.sample', __FILE__), file)
end

Instance Method Details

#debug?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/aws_config.rb', line 24

def debug?
  @opts[:debug] || false
end

#egress?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/aws_config.rb', line 12

def egress?
  @opts.key?(:egress) ? @opts[:egress] : true
end

#exclusionsObject



8
9
10
# File 'lib/aws_config.rb', line 8

def exclusions
  @exclusions ||=Exclusions.new(@opts[:exclude])
end

#formatObject



20
21
22
# File 'lib/aws_config.rb', line 20

def format
  @opts[:format] || 'dot'
end

#groupsObject



16
17
18
# File 'lib/aws_config.rb', line 16

def groups
  @opts[:groups] || {}
end

#merge(opts) ⇒ Object



37
38
39
# File 'lib/aws_config.rb', line 37

def merge(opts)
  AwsConfig.new(@opts.merge!(opts))
end

#obfuscate?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/aws_config.rb', line 28

def obfuscate?
  @opts[:obfuscate] || false
end