Sha256: 9e053e0f603768fa1eeeb853540a0822b70e285310f96240d19bf31afe5594b1

Contents?: true

Size: 823 Bytes

Versions: 1

Compression:

Stored size: 823 Bytes

Contents

# BasePresenter

The gem adds "Presenter" functionality into Rails application.

## Installation

Add this line to your application's Gemfile:

    gem 'base_presenter'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install base_presenter

## Usage

In director root_rails/app/presenters create file example_presenter.rb with content

    class ExamplePresenter < BasePresenter
      presents :example
      delegate :name, :example

      def name
        "Name"
      end

      def self.class_name
        "Example"
      end
    end

and in file show.html.erb with:
* object @example

    <% present @example do |presenter| %>
      Name: <%= presenter.name %>
    <% end %>

* class Example

    <% present Example do |presenter| %>
      Class name: <%= presenter.class_name %>
    <% end %>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
base_presenter-0.0.5 README.md