module Redgraph::Util

Public Instance Methods

escape_value(x) click to toggle source
# File lib/redgraph/util.rb, line 12
def escape_value(x)
  case x
  when Integer then x
  when NilClass then "''"
  else
    '"' + x.gsub('"', '\"') + '"'
  end
end
properties_to_string(hash) click to toggle source
# File lib/redgraph/util.rb, line 5
def properties_to_string(hash)
  return if hash.empty?
  "{" +
  hash.map {|k,v| "#{k}:#{escape_value(v)}" }.join(", ") +
  "}"
end