Module: Diffend::Config::Fetcher

Defined in:
lib/diffend/config/fetcher.rb

Overview

Class responsible for fetching the config from .diffend.yml

Class Method Summary collapse

Class Method Details

.call(build_path) ⇒ OpenStruct

Returns open struct with config details.

Examples:

details = Fetcher.new.call('./')
details.build_path #=> './'

Parameters:

  • build_path (String)

    path of the current build

Returns:

  • (OpenStruct)

    open struct with config details



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/diffend/config/fetcher.rb', line 16

def call(build_path)
  OpenStruct.new(
    YAML.safe_load(
      ERB.new(
        File.read(
          FileFinder.call(build_path)
        )
      ).result
    ).merge(build_path: build_path)
  )
end