lib/onebox/view.rb in onebox-1.1.0 vs lib/onebox/view.rb in onebox-1.2.0

- old
+ new

@@ -1,21 +1,16 @@ module Onebox class View < Mustache - attr_reader :view + attr_reader :record - self.template_path = File.join(Gem::Specification.find_by_name("onebox").gem_dir, "templates") + self.template_path = Onebox.options.load_paths.last - def initialize(name, layout = false) - @layout = layout - self.template_name = unless @layout then name else "_layout" end - @view = View.new(name) if @layout + def initialize(name, record) + @record = record + self.template_name = name end - def to_html(record) - if @layout - render(url: record[:url], view: @view.to_html(record)) - else - render(record) - end + def to_html + render(record) end end end