Class: Mildred::Job

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

Defined Under Namespace

Classes: ParseError

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#destinations ⇒ Object (readonly)

Returns the value of attribute destinations.



9
10
11
# File 'lib/mildred/job.rb', line 9

def destinations
  @destinations
end

#directory ⇒ Object (readonly)

Returns the value of attribute directory.



9
10
11
# File 'lib/mildred/job.rb', line 9

def directory
  @directory
end

#name ⇒ Object (readonly)

Returns the value of attribute name.



9
10
11
# File 'lib/mildred/job.rb', line 9

def name
  @name
end

#tasks ⇒ Object (readonly)

Returns the value of attribute tasks.



9
10
11
# File 'lib/mildred/job.rb', line 9

def tasks
  @tasks
end

Class Method Details

.from_yaml(path) ⇒ Object

Raises:



11
12
13
14
15
16
17
# File 'lib/mildred/job.rb', line 11

def self.from_yaml(path)
  data = YAML.safe_load_file(path) || {}

  raise ParseError, "Missing 'jobs' key" unless data.is_a?(Hash) && data.key?("jobs")

  data["jobs"].map { |entry| parse_job(entry) }
end