lib/base_presenter.rb in base_presenter-0.0.4 vs lib/base_presenter.rb in base_presenter-0.0.5
- old
+ new
@@ -5,23 +5,37 @@
def initialize(object, template)
@object = object
@template = template
end
- def self.presents(name)
- define_method(name) do
- @object
- end
- end
-
def method_missing(*args, &block)
- @template.send(*args, &block)
+ h.send(*args, &block)
end
def handle_none(value)
if value.present?
yield
else
- @template.content_tag :span, "None given", class: "none"
+ h.content_tag :span, "None given", class: "none"
end
end
+
+ class << self
+ attr_accessor :template
+
+ def presents(name)
+ define_method(name) do
+ @object
+ end
+ end
+ end
+
+ private
+
+ def self.h
+ @@template
+ end
+
+ def h
+ @template
+ end
end