README.md in oprah-0.1.2 vs README.md in oprah-0.1.3

- old
+ new

@@ -16,10 +16,14 @@ * [Collections](#collections) * [Associations](#associations) * [Composition](#composition) + [Performance](#performance) + [Ordering](#ordering) + + [Choosing presenters](#choosing-presenters) +* [Testing](#testing) +* [API Documentation](#api-documentation) +* [Contributing](#contributing) * [License](#license) * [Author](#author) ## Overview @@ -30,11 +34,11 @@ So why another presenter/decorator library? Oprah was written with a few simple goals in mind only covered partially (or not at all) by other gems: - Lightweight - Presenters should be easy to test -- No monkey patching :monkey::gun: +- Avoid monkey patching, where possible :monkey::gun: - Embrace convention over configuration - First-class support for composition (modules and concerns) ## Installation @@ -236,9 +240,54 @@ end Oprah.present(User.new).baz # => "foobar" ``` + +### Choosing presenters + +When presenting an object you can optionally choose which presenter classes +to use: + +``` ruby +Oprah.present(User.new, only: DescribablePresenter) +``` + +This parameter takes either a single presenter or an `Array` of presenters. +The presenter(s) given need to match the object's class or one of it's +ancestors. Non-matching presenters given will be ignored. + +## Testing + +Testing presenters is as simple as testing a regular class. Oprah also +provides couple of helpers to make it even easier: + +``` ruby +class UserPresenterTest < Minitest::Test + include Oprah::TestHelpers + + def setup + @presenter = present User.new + end + + def test_presented + assert_presented @presenter + end + + def test_name + assert_equal "John Doe", @presenter.name + end +end +``` + +## API Documentation + +Comprehensive API Documentation is available at +[rubydoc.info](http://www.rubydoc.info/gems/oprah). + +## Contributing + +Please check out our [contributing guidelines](CONTRIBUTING.md). ## License Released under the MIT license. See the LICENSE file for details.