Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Ruby
tree: 92c042948e

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
.gitignore
Gemfile
README.markdown
Rakefile
delegate_presenter.gemspec

README.markdown

Introduction

This gem includes a base class, DelegatePresenter::Base which all your presenter classes should inherit from.

So, creating a new presenter class:

class TodoPresenter < DelegatePresenter::Base
  def todo_name
    s("<br>", self.description)
  end
end

Wait, what did you just do?

You mean that little s hack? That's a way to keep yourself from going sane having to .html_escape everything.

See my blog article on this subject

So, what is DelegatePresenter, really?

DelegatePresenter does two things:

  1. Inherits from Ruby Standard Library's SimpleDelegator. This simple class solves many of the problems I've seen with decorators in the past. (calling object.method everywhere)

  2. Makes Rails helpers available to you via the helpers method, gives you s (above) and h (your old Rails 2 friend)

Installation

TODO: write me

Something went wrong with that request. Please try again.