Sha256: 173fc0afa0d9f3f70c46d5ff421e13650e14c96d21e3a811c78af354852c64f0
Contents?: true
Size: 738 Bytes
Versions: 3
Compression:
Stored size: 738 Bytes
Contents
# frozen_string_literal: true require 'yaml' module Riserva class Config DEFAULT_PATH = 'config/riserva.yml' def initialize @path = ENV['RISERVA_CONFIG'] || DEFAULT_PATH end def self.read(yaml_path) new.read(yaml_path) end def read(yaml_path) keys = yaml_path.split('.') config.dig(*keys) end def self.folders read('folders').each { |folder| yield Pathname.new(folder) } end def self.storages read('storage').keys.each do |storage| klass = "Riserva::Storage::#{storage.camelize}" yield(klass.safe_constantize.new) unless klass.nil? end end private def config @config ||= YAML.load_file(@path) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
riserva-0.1.6 | lib/riserva/config.rb |
riserva-0.1.5 | lib/riserva/config.rb |
riserva-0.1.4 | lib/riserva/config.rb |