Class: Mongobile::App

Inherits:
Sinatra::Base
  • Object
show all
Includes:
MongoHelper
Defined in:
lib/mongobile/app.rb

Instance Method Summary collapse

Methods included from MongoHelper

#connection, #db, #document_list, #file_size, #find_doc, #get_key, #normalize_stats, #ops_per_second, #query_options, #server_status

Instance Method Details

#humanize(v, quote = true) ⇒ Object



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/mongobile/app.rb', line 102

def humanize(v, quote = true)
  if v.nil? && quote
    "null"
  elsif v.kind_of?(Hash)
    JSON.pretty_generate(v)
  elsif v.kind_of?(Array)
    JSON.pretty_generate(v)
  elsif v.kind_of?(Time)
    v.strftime("%d %B %Y %H:%M:%S").inspect
  elsif quote
    v.inspect
  else
    v
  end
end