Socket
Book a DemoInstallSign in
Socket

gleborator

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gleborator

1.0.0
bundlerRubygems
Version published
Maintainers
1
Created
Source

Gleborator

It is velosiped of draper gem created by Gleb Vishnevsky.

Installation

Add this line to your application's Gemfile:

gem 'gleborator'

And then execute:

$ bundle

Or install it yourself as:

$ gem install gleborator

Usage

You have to call decorate method on what you want to decorate

# app/controllers/posts_controller.rb
def show
  @post = Post.find(params[:id]).decorate
end

It will search for PostDecorator and create instance of it. There you can create your own methods to keep your views cleaner.

# app/decorators/post_decorator.rb
class PostDecorator < ApplicationDecorator
  delegate :id, :title, :body
  delegate :name, to: :author, prefix: true

  def title_with_author_name
    "#{object.title} (#{object.author_name)})"
  end
end

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/kaikash/gleborator.

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 26 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.