Sha256: 3449eb2c457b78a938fd030e34eb34bc1d81473bb4312b0a4d2a2f3b52090303
Contents?: true
Size: 771 Bytes
Versions: 3
Compression:
Stored size: 771 Bytes
Contents
# frozen_string_literal: true require "yaml" require "logger" require "repository" module RubyRemoteConfig # FileRepository is a struct that implements the Repository interface for # handling configuration data stored in a YAML file. class FileRepository include RubyRemoteConfig::Repository attr_reader :path def initialize(name:, path:) super(name: name) @path = path end # Refresh reads the YAML file, unmarshal it into the data map. def refresh @lock.synchronize do # Read the YAML file data = File.read(@path) # Unmarshal the YAML data into the data map @data = YAML.safe_load(data) # Store the raw data of the YAML file @raw_data = data end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ruby-remote-config-1.0.4 | lib/file_repository.rb |
ruby-remote-config-1.0.3 | lib/file_repository.rb |
ruby-remote-config-1.0.2 | lib/file_repository.rb |