Method: Spring::OkJson#valenc

Defined in:
lib/spring/json.rb

#valenc(x) ⇒ Object



97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/spring/json.rb', line 97

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