Sha256: da462047eaf888fa5a1b4f5c4467b4982d5d7f50fa081aefbc2f0be8c8621946

Contents?: true

Size: 759 Bytes

Versions: 1

Compression:

Stored size: 759 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:

  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 a 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) }

== Maintainers

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tokenie-0.0.1 README.rdoc