module JSON

def self.generate(obj, opts=nil)

def self.generate(obj, opts=nil)
  opts ||= {}
  options_map = {}
  if opts.has_key?(:indent)
    options_map[:pretty] = true
    options_map[:indent] = opts[:indent]
  end
  FFI_Yajl::Encoder.encode(obj, options_map)
rescue FFI_Yajl::EncodeError => e
  raise JSON::GeneratorError, e.message
end