Sha256: d8032be45f8453db60925114945336dc99d032425a7126139760f61b86b5b995

Contents?: true

Size: 681 Bytes

Versions: 1

Compression:

Stored size: 681 Bytes

Contents

# Decoru

A simple decorator for Rails models.

## Usage

```ruby
# app/controllers/users_controller.rb
def show
  @user = User.find(params[:id]).decorate
end

def index
  @users = User.first(10).decorate
end
```

```ruby
# app/decorators/user_decorator.rb
class UserDecorator < Decoru::Decorator
  def full_name
    [first_name, last_name].join(' ')
  end
end
```

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'decoru'
```

And then execute:

```bash
$ bundle
```

Or install it yourself as:

```bash
$ gem install decoru
```

## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
decoru-0.1.0 README.md