Module: Herbert::Utils::Helpers

Defined in:
lib/herbert/Utils.rb

Constant Summary collapse

Range =
[('0'..'9').to_a,('a'..'z').to_a].flatten

Instance Method Summary collapse

Instance Method Details

#db_id(source) ⇒ Object



34
35
36
# File 'lib/herbert/Utils.rb', line 34

def db_id(source)
  BSON::ObjectId.from_string(source.to_s)
end

#nonce(length = 16) ⇒ Object



28
29
30
31
32
# File 'lib/herbert/Utils.rb', line 28

def nonce(length = 16)
  res = ''
  length.times  {res += Range[rand(36)]}
  res
end

#versionObject



23
24
25
# File 'lib/herbert/Utils.rb', line 23

def version
  Utils.version
end