1
0
Fork 0
mirror of https://github.com/kaminari/kaminari.git synced 2022-11-09 13:44:37 -05:00

Now kaminari supports grape gem.

This commit is contained in:
Łukasz Śliwa 2012-03-13 22:58:55 +01:00
parent 118927a42e
commit be46fb7648
3 changed files with 20 additions and 0 deletions

1
.gitignore vendored
View file

@ -1,5 +1,6 @@
*.gem
.bundle
.idea
Gemfile.lock
pkg/*

View file

@ -31,6 +31,9 @@ when Rails:
when Sinatra/Padrino:
gem 'kaminari', :require => 'kaminari/sinatra'
when Grape:
gem 'kaminari', :require => 'kaminari/grape'
EOC
end
@ -51,6 +54,8 @@ when Sinatra/Padrino:
require 'kaminari/engine'
elsif sinatra?
require 'kaminari/sinatra'
elsif grape?
require 'kaminari/grape'
else
Kaminari::Hooks.init!
end
@ -68,6 +73,10 @@ when Sinatra/Padrino:
def self.sinatra?
defined?(::Sinatra)
end
def self.grape?
defined?(::Grape)
end
end
Kaminari.load!

10
lib/kaminari/grape.rb Normal file
View file

@ -0,0 +1,10 @@
begin
require 'grape'
rescue LoadError
raise LoadError, "couldn't load `grape`, check out if appropriately bundled grape gem?"
end
require 'kaminari'
Kaminari::Hooks.init!