class Confer::Recipe

Public: Encapsulates a recipe. Usually instantiated by calling a method from a mixed in module such as ‘Confer::Recipe::Yaml`.

Attributes

steps[R]

Public: An Array of steps this recipe contains.

Public Class Methods

from_array(array) click to toggle source

Public: Loads a recipe from an array of steps.

array - An Array containing a Hash of options indexed by name for each

step in the recipe.

Returns a Recipe instance.

# File lib/confer/recipe.rb, line 38
def self.from_array(array)
  Recipe.new array.map { |e| Step.new(*e.first) }
end
from_file(path) click to toggle source

Public: Loads a recipe from a YAML file.

path - A String containing the path to the YAML file to load.

Returns a Recipe instance.

# File lib/confer/recipe.rb, line 22
def self.from_file(path)
  self.from_array YAML.load File.open(path, 'r').read
rescue Errno::ENOENT => e
  raise RecipeNotFoundError.new(e)
rescue Psych::SyntaxError => e
  raise RecipeSyntaxError.new(e)
end
new(steps = []) click to toggle source

Public: Instantiate a new instance with the given steps.

array - An Array of Hash objects defining the steps for this recipe. opts - A Hash of options.

# File lib/confer/recipe.rb, line 53
def initialize(steps = [])
  @steps = steps
end