README.md in bourgeois-0.1.2 vs README.md in bourgeois-0.1.3
- old
+ new
@@ -1,13 +1,21 @@
-# Bourgeois
+<p align="center">
+ <a href="https://github.com/mirego/bourgeois">
+ <img src="http://i.imgur.com/Z8ja8Wz.png" alt="Bourgeois" />
+ </a>
+ <br />
+ Bourgeois is a Ruby library that makes using presenters a very simple thing.
+ <br /><br />
+ <a href="https://rubygems.org/gems/bourgeois"><img src="https://badge.fury.io/rb/bourgeois.png" /></a>
+ <a href="https://codeclimate.com/github/mirego/bourgeois"><img src="https://codeclimate.com/github/mirego/bourgeois.png" /></a>
+ <a href='https://coveralls.io/r/mirego/bourgeois?branch=master'><img src='https://coveralls.io/repos/mirego/bourgeois/badge.png?branch=master' /></a>
+ <a href='https://gemnasium.com/mirego/bourgeois'><img src="https://gemnasium.com/mirego/bourgeois.png" /></a>
+ <a href="https://travis-ci.org/mirego/bourgeois"><img src="https://travis-ci.org/mirego/bourgeois.png?branch=master" /></a>
+</p>
-[![Gem Version](https://badge.fury.io/rb/bourgeois.png)](https://rubygems.org/gems/bourgeois)
-[![Code Climate](https://codeclimate.com/github/mirego/bourgeois.png)](https://codeclimate.com/github/mirego/bourgeois)
-[![Build Status](https://travis-ci.org/mirego/bourgeois.png?branch=master)](https://travis-ci.org/mirego/bourgeois)
+---
-Bourgeois is a Ruby library that makes using presenters a very simple thing.
-
## Installation
Add this line to your application’s Gemfile:
```ruby
@@ -51,9 +59,34 @@
def birthdate
# To get the original `birthdate` value, you can either use `super` or `object.birthdate`
super.presence || view.content_tag(:em, 'Unknown')
end
end
+```
+
+### Custom block helpers
+
+You can use the simple `helper` DSL to define block helpers that will be executed if certain
+conditions are matched.
+
+```ruby
+class UserPresenter < Bourgeois::Presenter
+ helper :with_profile, if: -> { profile.present? && profile.public? }
+end
+
+User.first.new = Profile.create(public: true, title: 'Foo', description: 'Bar')
+```
+
+```erb
+<% present User.first do |user| %>
+ <h1><%= user.full_name %></h1>
+ <% user.with_profile do %>
+ <div class="profile">
+ <h2><%= user.profile.title %></h2>
+ <%= simple_format(user.profile.description) %>
+ </div>
+ <% end %>
+<% end %>
```
## Inspiration
Bourgeois was inspired by some code [@rafBM](https://twitter.com/rafBM) wrote for [his OpenCode talk](https://github.com/rafBM/opencode12-rails) on May 28th, 2013.