lib/base_presenter.rb in base_presenter-0.0.5 vs lib/base_presenter.rb in base_presenter-0.0.6

- old
+ new

@@ -1,23 +1,25 @@ require "base_presenter/version" require "application_helper" + class BasePresenter def initialize(object, template) @object = object @template = template end def method_missing(*args, &block) - h.send(*args, &block) + @template.send(*args, &block) end + # Return span with 'None given' when value is blank def handle_none(value) if value.present? yield else - h.content_tag :span, "None given", class: "none" + content_tag :span, "None given", class: "none" end end class << self attr_accessor :template @@ -25,17 +27,13 @@ def presents(name) define_method(name) do @object end end - end - private - - def self.h - @@template + def method_missing(*args, &block) + @@template.send(*args, &block) end - def h - @template - end + end + end