Sha256: 6703fbd8296914f4d92dbca00389689f933d7f4a334a1b6e100fc0c2bf3a9bce

Contents?: true

Size: 729 Bytes

Versions: 1

Compression:

Stored size: 729 Bytes

Contents

require "base_presenter/version"
require "base_presenter/application_helper"

class BasePresenter

  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

  def self.method_missing(*args, &block)
    @@template.send(*args, &block)
  end

  def self.presents(name)
    define_method(name) do
      @object
    end
  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
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
base_presenter-0.1.0 lib/base_presenter.rb