Sha256: fe5fb8091d3041c69fbb1041652017e344d6cf20ba76820e3df5d6fdf16fa8b9

Contents?: true

Size: 481 Bytes

Versions: 1

Compression:

Stored size: 481 Bytes

Contents

require "base_presenter/version"
require "application_helper"
class BasePresenter

  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)
  end

  def handle_none(value)
    if value.present?
      yield
    else
      @template.content_tag :span, "None given", class: "none"  
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
base_presenter-0.0.4 lib/base_presenter.rb