Class: Task
- Inherits:
-
Object
- Object
- Task
- Defined in:
- lib/yamlease.rb
Instance Attribute Summary collapse
-
#display_name ⇒ Object
readonly
Returns the value of attribute display_name.
-
#task_id ⇒ Object
readonly
Returns the value of attribute task_id.
-
#yaml ⇒ Object
writeonly
Sets the attribute yaml.
Instance Method Summary collapse
- #convert_vars_to_yaml(text) ⇒ Object
-
#initialize(yaml) ⇒ Task
constructor
A new instance of Task.
- #inputs ⇒ Object
- #yaml_name ⇒ Object
Constructor Details
#initialize(yaml) ⇒ Task
Returns a new instance of Task.
57 58 59 60 61 |
# File 'lib/yamlease.rb', line 57 def initialize(yaml) @yaml = yaml @display_name = yaml.name @task_id = yaml.taskId end |
Instance Attribute Details
#display_name ⇒ Object (readonly)
Returns the value of attribute display_name.
55 56 57 |
# File 'lib/yamlease.rb', line 55 def display_name @display_name end |
#task_id ⇒ Object (readonly)
Returns the value of attribute task_id.
55 56 57 |
# File 'lib/yamlease.rb', line 55 def task_id @task_id end |
#yaml=(value) ⇒ Object (writeonly)
Sets the attribute yaml
54 55 56 |
# File 'lib/yamlease.rb', line 54 def yaml=(value) @yaml = value end |
Instance Method Details
#convert_vars_to_yaml(text) ⇒ Object
67 68 69 |
# File 'lib/yamlease.rb', line 67 def convert_vars_to_yaml(text) text.gsub(/\$\((.+)\)/, '${{\1}}') end |
#inputs ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/yamlease.rb', line 71 def inputs _inputs = @yaml.inputs _inputs.delete_if { |key, value| value == "" } _inputs.each do |key, value| if value.include?('*') _inputs[key] = "'#{value}'" end value = _inputs[key] _inputs[key] = convert_vars_to_yaml(value) end _inputs end |
#yaml_name ⇒ Object
63 64 65 |
# File 'lib/yamlease.rb', line 63 def yaml_name TaskDefinition.yaml_name(task_id) end |