replicator/support/api/ruby/lib/json/pure/generator.rb
def generate(obj)
          result = obj.to_json(self)
          if result !~ /\A\s*(?:\[.*\]|\{.*\})\s*\Z/m
            raise GeneratorError, "only generation of JSON objects or arrays allowed"
          end
          result
        end
# Generates a valid JSON document from object +obj+ and returns the
# result. If no valid JSON document can be created this method raises a
# GeneratorError exception.
Generates a valid JSON document from object +obj+ and returns the
result. If no valid JSON document can be created this method raises a
GeneratorError exception.
Generates a valid JSON document from object + obj + and returns the result . If no valid JSON document can be created this method raises a GeneratorError exception .
def generate(obj)
          result = obj.to_json(self)
          if result !~ /\A\s*(?:\[.*\]|\{.*\})\s*\Z/m
            raise GeneratorError, "only generation of JSON objects or arrays allowed"
          end
          result
        end
def generate ( obj ) result = obj . to_json ( self ) if result !~ / \A \s *(?: \[ .* \] | \{ .* \} ) \s * \Z /m raise GeneratorError , "only generation of JSON objects or arrays allowed" end result end
Generates a valid JSON document from object +obj+ and returns the
result.
Generates a valid JSON document from object + obj + and returns the result .
obj