Class: Task

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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_nameObject (readonly)

Returns the value of attribute display_name.



55
56
57
# File 'lib/yamlease.rb', line 55

def display_name
  @display_name
end

#task_idObject (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

Parameters:

  • value

    the value to set the attribute yaml to.



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

#inputsObject



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_nameObject



63
64
65
# File 'lib/yamlease.rb', line 63

def yaml_name
  TaskDefinition.yaml_name(task_id)
end