lib/rcurse/helpers/include.rb in rcurse-0.4.0 vs lib/rcurse/helpers/include.rb in rcurse-0.5.1
- old
+ new
@@ -1,3 +1,8 @@
-Rcurse.add_helper(Rcurse::Helper.new("include") do |args|
- Rcurse::render File.read(args[0])
-end)
+Rcurse::Helper.new("include") do |args, context|
+ if context.path then
+ file_path = File.expand_path(args[0], context.path)
+ else
+ file_path = args[0]
+ end
+ Rcurse::render(File.read(file_path), context)
+end
\ No newline at end of file