Sha256: 27e10606270f785f54449cebc2133a7d4d86a05998c0786a6ce366f734c2eb7f

Contents?: true

Size: 821 Bytes

Versions: 1

Compression:

Stored size: 821 Bytes

Contents

= Tokenie

Tokenie gem provides generation friendly token randomically.

== Installation

Install as a gem from GemCutter:

  gem install tokenie

== Getting Started

Generate a token:

  require 'tokenie'
  Tokenie.friendly # => "De6paD"

By default it uses 6 characters for end string. To change it use :length option:

  Tokenie.friendly(:length => 8) # => "gRaxwBg7"

If you want to ensure uniqueness you should provide a block which returns false in the case that means the token is not included in your storage:

  existing_tokens = ['qwerty1', 'qwerty2', 'qwerty3']
  Tokenie.friendly { |token| existing_tokens.include?(token) }

Example with ActiveRecord:

  Tokenie.friendly { |t| self.class.exists?(:token => t) }

== Dependencies

* Ruby 1.8.7 or later

== Maintainers

* Andrew Djoga <andrew.djoga@gmail.com>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tokenie-0.0.2 README.rdoc