lib/pears/subject.rb in pears-0.2.0 vs lib/pears/subject.rb in pears-0.3.0
- old
+ new
@@ -1,19 +1,18 @@
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.
+ # of its domain. for instance: application_settings, theming or translaions.
class Subject
include Enumerable
attr_reader :name
def initialize(name, *layers)
@name = name
@layers = layers
- Pears.subjects << self
end
def [](key)
project[key]
end
@@ -26,9 +25,13 @@
project.has_key? key
end
def dig(*args)
project.dig(*args)
+ end
+
+ def purge
+ @layers.each.each(&:purge)
end
def push_layer(layer)
@layers << layer
end