lib/pears/subject.rb in pears-0.3.0 vs lib/pears/subject.rb in pears-0.3.1
- old
+ new
@@ -6,13 +6,15 @@
# of its domain. for instance: application_settings, theming or translaions.
class Subject
include Enumerable
attr_reader :name
- def initialize(name, *layers)
+ def initialize(name, *layers, loader: ->(builder){} )
@name = name
@layers = layers
+ @loader = loader
+ boot
end
def [](key)
project[key]
end
@@ -46,10 +48,20 @@
def each(&block)
project.each(&block)
end
+ def reboot
+ purge
+ @layers = []
+ boot
+ end
+
private
+
+ def boot
+ @loader.call(Provider::Builder.new(self))
+ end
def layers
@layers
end
end