Sha256: e70adf7d66205d76776d9e74a2544cc8008b5092db37e7dac78c8a18e2afc616
Contents?: true
Size: 958 Bytes
Versions: 2
Compression:
Stored size: 958 Bytes
Contents
module Configurations module Maps class Properties attr_reader :map class Entry end def initialize(reader = Readers::Tolerant.new) @map = {} @reader = reader end def empty? @map.empty? end def add(properties) properties.each do |property| add_entry(property, @map) end end def entries_at(path) @reader.read(@map, path) || {} end def configurable?(path) !!@reader.read(@map, path) end def add_entry(property, subtree) if property.is_a?(Hash) property.each do |key, val| subtree[key] = add_entry(val, subtree.fetch(key, {})) end elsif property.is_a?(Array) property.each do |val| add_entry(val, subtree) end else subtree[property] = Entry.new end subtree end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
configurations-2.2.2 | lib/configurations/maps/properties.rb |
configurations-2.2.1 | lib/configurations/maps/properties.rb |