New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

leaf

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

leaf

  • 0.1.3
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= Leaf

A really simple pagination library, heavily based on the agnostic branch of {will_paginate}[http://github.com/mislav/will_paginate/tree/agnostic].

= Description

Leaf supports pagination for collections responding to +total_pages+, +per_page+, +previous_page+ and +total_entries+ in Sinatra views out of the box.

It currently supports two renderers: +Leaf::ViewHelpers::LinkRenderer+ and +Leaf::ViewHelpers::ListRenderer+

== Installation

gem install leaf

== Example usage

require 'rubygems' require 'sinatra' require 'leaf'

include Leaf::ViewHelpers::Base

Needed to paginate any array

you’ll probably use something else.

require 'leaf/array'

get '/' do page = (params[:page]) ? params[:page] : 1 array = ('a'..'z').to_a

haml :index, :locals => { 
  :collection => array.paginate({
    :page => page, 
    :per_page => 5
  }) 
}

end

END @@ index = leaf(collection, :renderer => Leaf::ViewHelpers::ListRenderer) %ul - collection.each do |letter| %li= letter

== Authors and credits

Leaf is based on {will_paginate}[http://github.com/mislav/will_paginate/] which was originally written by PJ Hyett, who later handed over development to Mislav Marohnić. (The library was completely rewritten since then.)

FAQs

Package last updated on 29 Jun 2010

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc