Sha256: 2f49eeb71107fe55c1b670a8fdbc7250faf2067f0fbf04b6f0e7cefbbaea0755

Contents?: true

Size: 608 Bytes

Versions: 1

Compression:

Stored size: 608 Bytes

Contents

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

  def initialize(object, template)
    @object = object
    @template = template
  end

  def method_missing(*args, &block)
    h.send(*args, &block)
  end

  def handle_none(value)
    if value.present?
      yield
    else
      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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
base_presenter-0.0.5 lib/base_presenter.rb