Sha256: d4368d9109af9123d63b27426d2c803390d3e2183a1518fdc9a62213bb455e9a
Contents?: true
Size: 971 Bytes
Versions: 1
Compression:
Stored size: 971 Bytes
Contents
= Tokenie {<img src="https://secure.travis-ci.org/Djo/tokenie.png" />}[http://travis-ci.org/Djo/tokenie] Tokenie gem provides generation friendly token randomically. Symbols '+/=1lIO0o' are replaced with 'abcdefghj'. == 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 the 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 } An 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.3 | README.rdoc |