lib/lbrt/service/dsl/context.rb in lbrt-0.1.4 vs lib/lbrt/service/dsl/context.rb in lbrt-0.1.5
- old
+ new
@@ -1,20 +1,29 @@
class Lbrt::Service::DSL::Context
include Lbrt::Utils::ContextHelper
+ include Lbrt::Utils::TemplateHelper
def self.eval(dsl, path, options = {})
self.new(path, options) {
eval(dsl, binding, path)
}
end
attr_reader :result
+ attr_reader :context
def initialize(path, options = {}, &block)
@path = path
@options = options
@result = {}
+
+ @context = Hashie::Mash.new(
+ :path => path,
+ :options => options,
+ :templates => {}
+ )
+
instance_eval(&block)
end
private
@@ -25,9 +34,9 @@
if @result[key]
raise "Service `#{type}/#{title}` is already defined"
end
- srvc = Lbrt::Service::DSL::Context::Service.new(type, title, &block).result
+ srvc = Lbrt::Service::DSL::Context::Service.new(@context, type, title, &block).result
@result[key] = srvc
end
end