lib/onebox/engine.rb in onebox-1.0.0 vs lib/onebox/engine.rb in onebox-1.0.1
- old
+ new
@@ -36,10 +36,19 @@
def raw
raise NoMethodError, "Engines need to implement this method"
end
def template
- File.read(File.join("templates", "#{template_name}.handlebars"))
+ File.read(template_path)
+ end
+
+ def template_path
+ File.join(root, "templates", "#{template_name}.handlebars")
+ end
+
+ # returns the gem root directory
+ def root
+ Gem::Specification.find_by_name("onebox").gem_dir
end
# calculates handlebars template name for onebox using name of engine
def template_name
self.class.name.split("::").last.downcase.gsub(/onebox/, "")