lib/pears/subject.rb in pears-0.0.2 vs lib/pears/subject.rb in pears-0.0.3

- old
+ new

@@ -1,5 +1,7 @@ +require 'active_support/core_ext/hash/indifferent_access' + module Pears # A subject is a collection of settings. # You could different Pears::Subjects in your application for different parts # of its domain. for instance: application_settings, theming or translations. class Subject @@ -21,18 +23,22 @@ def has_key?(key) project.has_key? key end + def dig(*args) + project.dig(*args) + end + def push_layer(layer) @layers << layer end # Projects the layers to a hash that van be used as a single source of truth. def project layers.reverse.reduce(Hash.new) do |hash, layer| hash.deep_merge(layer.data) - end + end.with_indifferent_access end private def layers