# frozen_string_literal: true require 'yaml' module Diffend # Module for all the components related to setting up the config module Config # Class responsible for fetching the config from .diffend.yml module Fetcher class << self # @param build_path [String] path of the current build # @return [OpenStruct] open struct with config details # @example # details = Fetcher.new.call('./') # details.build_path #=> './' def call(build_path) OpenStruct.new( YAML.safe_load( ERB.new( File.read( FileFinder.call(build_path) ) ).result ).merge(build_path: build_path) ) end end end end end