lib/base_presenter.rb in base_presenter-0.0.9 vs lib/base_presenter.rb in base_presenter-0.0.10
- old
+ new
@@ -6,34 +6,36 @@
def initialize(object, template)
@object = object
@template = template
end
+ def self.initialize(object, template)
+ @@object = object
+ @@template = template
+ end
+
+ private
+
def method_missing(*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
- content_tag :span, "None given", class: "none"
- end
+ def self.method_missing(*args, &block)
+ @@template.send(*args, &block)
end
- def self.initialize(object, template)
- @@object = object
- @@template = template
- end
-
def self.presents(name)
define_method(name) do
@object
end
end
- def self.method_missing(*args, &block)
- @@template.send(*args, &block)
+ # Return span with 'None given' when value is blank
+ def handle_none(value)
+ if value.present?
+ yield
+ else
+ content_tag :span, "None given", class: "none"
+ end
end
end