class BasePresenter
Constants
- VERSION
Public Class Methods
initialize(object, template)
click to toggle source
# File lib/base_presenter.rb, line 11 def self.initialize(object, template) @@object = object @@template = template end
new(object, template)
click to toggle source
# File lib/base_presenter.rb, line 6 def initialize(object, template) @object = object @template = template end
Private Class Methods
method_missing(*args, &block)
click to toggle source
# File lib/base_presenter.rb, line 22 def self.method_missing(*args, &block) @@template.send(*args, &block) end
presents(name)
click to toggle source
# File lib/base_presenter.rb, line 26 def self.presents(name) define_method(name) do @object end end
Private Instance Methods
handle_none(value) { || ... }
click to toggle source
Return span with ‘None given’ when value is blank
# File lib/base_presenter.rb, line 33 def handle_none(value) if value.present? yield else content_tag :span, "None given", class: "none" end end
method_missing(*args, &block)
click to toggle source
# File lib/base_presenter.rb, line 18 def method_missing(*args, &block) @template.send(*args, &block) end