lib/base_presenter.rb in base_presenter-0.0.3 vs lib/base_presenter.rb in base_presenter-0.0.4
- old
+ new
@@ -1,8 +1,7 @@
require "base_presenter/version"
require "application_helper"
-
class BasePresenter
def initialize(object, template)
@object = object
@template = template
@@ -16,6 +15,13 @@
def method_missing(*args, &block)
@template.send(*args, &block)
end
+ def handle_none(value)
+ if value.present?
+ yield
+ else
+ @template.content_tag :span, "None given", class: "none"
+ end
+ end
end