Sha256: 91cea8e046c621790ad6b873fad712b857963015c197cdf0616c5f20b2ca96b9

Contents?: true

Size: 812 Bytes

Versions: 3

Compression:

Stored size: 812 Bytes

Contents

require "active_support/dependencies"

module Shortener

  autoload :ActiveRecordExtension, "shortener/active_record_extension"
  autoload :ShortenUrlInterceptor, "shortener/shorten_url_interceptor"

  CHARSETS = {
    :alphanum => ('a'..'z').to_a + (0..9).to_a,
    :alphanumcase => ('a'..'z').to_a + ('A'..'Z').to_a + (0..9).to_a }

  # default key length: 5 characters
  mattr_accessor :unique_key_length
  self.unique_key_length = 5

  # character set to chose from:
  #  :alphanum     - a-z0-9     -  has about 60 million possible combos
  #  :alphanumcase - a-zA-Z0-9  -  has about 900 million possible combos
  mattr_accessor :charset
  self.charset = :alphanum

  def self.key_chars
    CHARSETS[charset]
  end
end

# Require our railtie and engine
require "shortener/railtie"
require "shortener/engine"

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shortener-0.3.1 lib/shortener.rb
shortener-0.3.0 lib/shortener.rb
shortener-0.2.0 lib/shortener.rb