No commit activity in last 3 years
No release in over 3 years
Eliminates the repetitive response code in your Padrino controllers
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0.10.7
>= 0
 Project Readme

padrino-response

Eliminates the repetitive response code in your Padrino controllers

Installation

Via rubygems:

$ gem install padrino-responders

Or add add the following to your Gemfile:

gem 'padrino-response'

Now register it in your application:

class App < Padrino::Application
  register Padrino::Response
end

Usage Examples

Basic:

get :user, map: '/user' do
  respond @user
end

With a status code:

post :unauthorized_user, map: => '/unauthurized-user' do
  respond :unauthorized
end

Skip the object:

get :not_found, map: '/not-found' do
  respond :not_found 
end

Customizing the responder:

Via options:

class CustomResponder < Padrino::Responders::Default
end

get :custom_responder, map: '/custom-responder' do
  respond responder: "CustomResponder"
end

Specify a responder for the controller:

class Padrino::Responders::Main < Padrino::Responders::Default
end

Five Second Contributions Guide

  • Fork
  • Make changes in a branch
  • Write tests
  • Commit
  • Pull Request

Copyright

This started out as a fork of nu7hatch's padrino-responders; my fork diverged enough that I felt it was best to make an entirely new gem. I cant thank nu7hatch enough for the original code .

Licensed under MIT