README.md in bourgeois-0.1.1 vs README.md in bourgeois-0.1.2

- old
+ new

@@ -1,8 +1,9 @@ # Bourgeois [![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 @@ -39,10 +40,21 @@ <% present User.first do |user| %> <p>This is <%= user.formatted_name %></p> <% end %> ``` -Methods that aren’t in the presenter (`first_name` and `last_name`) are delegated to the presented object. You can also use the `view` method in the presenter to get the original view it was called in. +Methods that aren’t in the presenter (`first_name` and `last_name`) are delegated to the presented object. You can also use the `view` method in the presenter to get the original view it was called in: + +```ruby +# app/presenters/user_presenter.rb + +class UserPresenter < Bourgeois::Presenter + 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 +``` ## 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.