Sha256: 3779929989cc28bce2c624630362927942ae85894eb15e0000b8c77f058cdd03

Contents?: true

Size: 520 Bytes

Versions: 1

Compression:

Stored size: 520 Bytes

Contents

require 'nokogiri'
require "eric_tools/version"

require File.dirname(__FILE__) + '/eric_tools/business_exception.rb'

module EricTools
  def self.uuid
    UUIDTools::UUID.timestamp_create.to_s
  end

  #type=1表示只包含数字,type=2表示只包含字母,type=3表示都包含
  def self.generate_random_string length, type=1
    case type
      when 1
        rand(10 ** length).to_s(10)
      when 2
        rand(26 ** length).to_s(26)
      when 3
        rand(36 ** length).to_s(36)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eric_tools-0.0.3 lib/eric_tools.rb