class Minimart::InventoryRequirement::LocalRequirementsBuilder

This class is used to parse any local path requirements specified in the inventory and build Minimart::Inventory::LocalPathRequirements from them.

Attributes

name[R]

@return [String] the name of the cookbook defined by this requirement.

path[R]

@return [String] the path to the cookbook

Public Class Methods

new(name, reqs) click to toggle source

@param [String] name The name of the cookbook defined by this requirement. @param [Hash] reqs @option reqs [String] 'path' The path to the cookbook

# File lib/minimart/inventory_requirement/local_requirements_builder.rb, line 18
def initialize(name, reqs)
  @name = name
  @path = reqs['path']
end

Public Instance Methods

build() click to toggle source

Build the local path requirements. @return [Array<Minimart::InventoryRequirement::LocalPathRequirement>]

# File lib/minimart/inventory_requirement/local_requirements_builder.rb, line 25
def build
  return [] if path.nil? || path.empty?
  [InventoryRequirement::LocalPathRequirement.new(name, path: path)]
end