class Riserva::Config
Constants
- DEFAULT_PATH
Public Class Methods
folders()
click to toggle source
# File lib/riserva/config.rb, line 22 def self.folders read('folders').map { |folder| Pathname.new(folder) } end
new()
click to toggle source
# File lib/riserva/config.rb, line 9 def initialize @path = ENV['RISERVA_CONFIG'] || DEFAULT_PATH end
read(yaml_path)
click to toggle source
# File lib/riserva/config.rb, line 13 def self.read(yaml_path) new.read(yaml_path) end
storages()
click to toggle source
# File lib/riserva/config.rb, line 26 def self.storages read('storage').keys.map do |storage| klass = "Riserva::Storage::#{storage.camelize}" klass.safe_constantize&.new end.compact end
Public Instance Methods
read(yaml_path)
click to toggle source
# File lib/riserva/config.rb, line 17 def read(yaml_path) keys = yaml_path.split('.') config.dig(*keys) end
Private Instance Methods
config()
click to toggle source
# File lib/riserva/config.rb, line 35 def config @config ||= YAML.load_file(@path) end