Sha256: 8ecbb31e78a07c966a9ea16ea5a68fde882e6337cc7c4c91835dbb2285197633

Contents?: true

Size: 296 Bytes

Versions: 3

Compression:

Stored size: 296 Bytes

Contents

module Doorkeeper::OAuth
  module RandomString
    def random_string
      SecureRandom.hex(32)
    end

    def unique_random_string_for(attribute)
      loop do
        token = random_string
        break token unless self.class.send("find_by_#{attribute}", token)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
doorkeeper-0.2.0 lib/doorkeeper/oauth/random_string.rb
doorkeeper-0.1.1 lib/doorkeeper/oauth/random_string.rb
doorkeeper-0.1.0 lib/doorkeeper/oauth/random_string.rb