Sha256: a84505f208d904b5ec2fc36cbaf7364656b0dea89501791b5401d51db2c9d5e0

Contents?: true

Size: 449 Bytes

Versions: 2

Compression:

Stored size: 449 Bytes

Contents

# frozen_string_literal: true

require 'yaml'

module Localer
  # Loads and parse Localer config file `.localer.yml`
  class Config < Service
    option :exclude, default: -> { [] }
    def call
      return unless File.exist?(filename)
      yaml = YAML.load_file(filename)
      @exclude = yaml["Exclude"] if yaml&.key?("Exclude")
      self
    end

    private

    def filename
      File.expand_path(".localer.yml", Dir.pwd)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
localer-0.0.2 lib/localer/config.rb
localer-0.0.1 lib/localer/config.rb