class Configurations::Maps::Properties
Attributes
map[R]
Public Class Methods
new(reader = Readers::Tolerant.new)
click to toggle source
# File lib/configurations/maps/properties.rb, line 8 def initialize(reader = Readers::Tolerant.new) @map = {} @reader = reader end
Public Instance Methods
add(properties)
click to toggle source
# File lib/configurations/maps/properties.rb, line 17 def add(properties) properties.each do |property| add_entry(property, @map) end end
add_entry(property, subtree)
click to toggle source
# File lib/configurations/maps/properties.rb, line 31 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
configurable?(path)
click to toggle source
# File lib/configurations/maps/properties.rb, line 27 def configurable?(path) !!@reader.read(@map, path) end
empty?()
click to toggle source
# File lib/configurations/maps/properties.rb, line 13 def empty? @map.empty? end
entries_at(path)
click to toggle source
# File lib/configurations/maps/properties.rb, line 23 def entries_at(path) @reader.read(@map, path) || {} end