Method: OkJson#valenc

Defined in:
lib/conify/okjson.rb

#valenc(x) ⇒ Object



421
422
423
424
425
426
427
428
429
430
431
432
433
# File 'lib/conify/okjson.rb', line 421

def valenc(x)
  case x
  when Hash    then objenc(x)
  when Array   then arrenc(x)
  when String  then strenc(x)
  when Numeric then numenc(x)
  when true    then "true"
  when false   then "false"
  when nil     then "null"
  else
    raise Error, "cannot encode #{x.class}: #{x.inspect}"
  end
end