Class: Shiplane::ComposeHash
- Inherits:
-
Object
- Object
- Shiplane::ComposeHash
- Defined in:
- lib/shiplane/compose_hash.rb
Instance Attribute Summary collapse
-
#compose_file ⇒ Object
Returns the value of attribute compose_file.
-
#production_config ⇒ Object
Returns the value of attribute production_config.
Instance Method Summary collapse
- #blacklisted_nodes ⇒ Object
- #compose_hash ⇒ Object
- #default_whitelisted_nodes ⇒ Object
-
#initialize(compose_file, production_config) ⇒ ComposeHash
constructor
A new instance of ComposeHash.
- #production_yml ⇒ Object
- #whitelisted_hash ⇒ Object
- #whitelisted_nodes ⇒ Object
Constructor Details
#initialize(compose_file, production_config) ⇒ ComposeHash
Returns a new instance of ComposeHash.
7 8 9 10 |
# File 'lib/shiplane/compose_hash.rb', line 7 def initialize(compose_file, production_config) @compose_file = compose_file @production_config = production_config end |
Instance Attribute Details
#compose_file ⇒ Object
Returns the value of attribute compose_file.
5 6 7 |
# File 'lib/shiplane/compose_hash.rb', line 5 def compose_file @compose_file end |
#production_config ⇒ Object
Returns the value of attribute production_config.
5 6 7 |
# File 'lib/shiplane/compose_hash.rb', line 5 def production_config @production_config end |
Instance Method Details
#blacklisted_nodes ⇒ Object
24 25 26 |
# File 'lib/shiplane/compose_hash.rb', line 24 def blacklisted_nodes @blacklisted_nodes ||= production_config.fetch('blacklist', []) end |
#compose_hash ⇒ Object
16 17 18 |
# File 'lib/shiplane/compose_hash.rb', line 16 def compose_hash @compose_hash ||= YAML.load(compose_file) end |
#default_whitelisted_nodes ⇒ Object
32 33 34 35 36 |
# File 'lib/shiplane/compose_hash.rb', line 32 def default_whitelisted_nodes [ "version", ] end |
#production_yml ⇒ Object
12 13 14 |
# File 'lib/shiplane/compose_hash.rb', line 12 def production_yml blacklisted_nodes.inject(whitelisted_hash){ |acc, node| acc.blacklist(node) } end |
#whitelisted_hash ⇒ Object
20 21 22 |
# File 'lib/shiplane/compose_hash.rb', line 20 def whitelisted_hash @whitelisted_hash ||= compose_hash.whitelist(*default_whitelisted_nodes, *whitelisted_nodes) end |
#whitelisted_nodes ⇒ Object
28 29 30 |
# File 'lib/shiplane/compose_hash.rb', line 28 def whitelisted_nodes @whitelisted_nodes ||= production_config.fetch('whitelist', []) end |