lib/magent_web/mongo_helper.rb in magent-0.6.1 vs lib/magent_web/mongo_helper.rb in magent-0.6.2
- old
+ new
@@ -53,11 +53,15 @@
def humanize(v, quote = false)
if v.nil? && quote
"null"
elsif v.kind_of?(Hash)
- JSON.pretty_generate(v)
+ buffer = ""
+ v.each do |k,v|
+ buffer << "#{k.inspect}: #{v.inspect} <br />"
+ end
+ buffer
elsif v.kind_of?(Array)
v.map{|e| e.nil? ? "null" : e }.join("<br />")
elsif v.kind_of?(Time)
v.strftime("%d %B %Y %H:%M:%S").inspect
elsif quote
@@ -77,8 +81,14 @@
end.join(" -> ")
end
def channel_name_for(queue_id)
queue_id.to_s.match("magent\.([^\.]+)")[1]
+ end
+
+ def queue_path(queue)
+ queue = queue.name if !queue.kind_of?(String)
+
+ "#{ENV["MAGENT_WEB_PATH"]}/queues/#{queue}"
end
end
end