Class: AwsConfig
- Inherits:
-
Object
- Object
- AwsConfig
- Defined in:
- lib/aws_config.rb
Class Method Summary collapse
Instance Method Summary collapse
- #debug? ⇒ Boolean
- #egress? ⇒ Boolean
- #exclusions ⇒ Object
- #format ⇒ Object
- #groups ⇒ Object
-
#initialize(opts = {}) ⇒ AwsConfig
constructor
A new instance of AwsConfig.
- #merge(opts) ⇒ Object
- #obfuscate? ⇒ Boolean
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.('../opts.yml.sample', __FILE__), file) end |
Instance Method Details
#debug? ⇒ Boolean
24 25 26 |
# File 'lib/aws_config.rb', line 24 def debug? @opts[:debug] || false end |
#egress? ⇒ Boolean
12 13 14 |
# File 'lib/aws_config.rb', line 12 def egress? @opts.key?(:egress) ? @opts[:egress] : true end |
#exclusions ⇒ Object
8 9 10 |
# File 'lib/aws_config.rb', line 8 def exclusions @exclusions ||=Exclusions.new(@opts[:exclude]) end |
#format ⇒ Object
20 21 22 |
# File 'lib/aws_config.rb', line 20 def format @opts[:format] || 'dot' end |
#groups ⇒ Object
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
28 29 30 |
# File 'lib/aws_config.rb', line 28 def obfuscate? @opts[:obfuscate] || false end |