Class: Putpaws::InfraTargetConfig
- Inherits:
-
Struct
- Object
- Struct
- Putpaws::InfraTargetConfig
- Defined in:
- lib/putpaws/infra_target_config.rb
Instance Attribute Summary collapse
-
#cluster ⇒ Object
Returns the value of attribute cluster.
-
#container_name ⇒ Object
Returns the value of attribute container_name.
-
#name ⇒ Object
Returns the value of attribute name.
-
#scheduler_role ⇒ Object
Returns the value of attribute scheduler_role.
-
#task_definition ⇒ Object
Returns the value of attribute task_definition.
Class Method Summary collapse
Instance Attribute Details
#cluster ⇒ Object
Returns the value of attribute cluster
4 5 6 |
# File 'lib/putpaws/infra_target_config.rb', line 4 def cluster @cluster end |
#container_name ⇒ Object
Returns the value of attribute container_name
4 5 6 |
# File 'lib/putpaws/infra_target_config.rb', line 4 def container_name @container_name end |
#name ⇒ Object
Returns the value of attribute name
4 5 6 |
# File 'lib/putpaws/infra_target_config.rb', line 4 def name @name end |
#scheduler_role ⇒ Object
Returns the value of attribute scheduler_role
4 5 6 |
# File 'lib/putpaws/infra_target_config.rb', line 4 def scheduler_role @scheduler_role end |
#task_definition ⇒ Object
Returns the value of attribute task_definition
4 5 6 |
# File 'lib/putpaws/infra_target_config.rb', line 4 def task_definition @task_definition end |
Class Method Details
.all ⇒ Object
21 22 23 24 25 26 |
# File 'lib/putpaws/infra_target_config.rb', line 21 def self.all load.map{|k,v| data = v.slice(*self.members) new(data.merge(name: k.to_s)) } end |
.find(name) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/putpaws/infra_target_config.rb', line 28 def self.find(name) infra_target_data = load data = infra_target_data[name.to_sym] return nil unless data data = data.slice(*self.members) new(data.merge({name: name.to_s})) end |
.load(path_prefix: '.putpaws') ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/putpaws/infra_target_config.rb', line 11 def self.load(path_prefix: '.putpaws') @infra_target_data ||= begin path = Pathname.new(path_prefix).join("infra.json").to_s data = File.exist?(path) ? JSON.parse(File.read(path), symbolize_names: true).to_h : {} data[:target] || {} end end |