resx_json v0.2.0 ResxJSON.Partial

Functions that can be used to build partials for a partial stream will be processed by ResxJSON.Encoder.

Link to this section Summary

Functions

Create part of a JSON array

Create part of a JSON object key

Create part of a JSON object

Create part of a JSON string value

Link to this section Functions

Create part of a JSON array.

A stream containing the following list of partials will result in the array "[]".

[ResxJSON.Partial.array(), ResxJSON.Partial.array(:end)] #=> "[]"

Any elements between the two array functions will be put inside the resulting array.

Create part of a JSON object key.

A stream containing the following list of partials will result in the key ""abcd":".

[ResxJSON.Partial.key("a"), ResxJSON.Partial.key(["b", "c"]), ResxJSON.Partial.key("d", :end)] #=> ""abcd":"

This should be used inside an object (ResxJSON.Partial.object/0) and should be followed by a value (literal or partial) that will become the value for that key.

Link to this function

key(data, atom)

Create part of a JSON object.

A stream containing the following list of partials will result in the object "{}".

[ResxJSON.Partial.object(), ResxJSON.Partial.object(:end)] #=> "{}"

Any key/value pairs between the two object functions will be put inside the resulting object. Keys should be referenced with by ResxJSON.Partial.key/1, while values may be partials or literals.

Create part of a JSON string value.

A stream containing the following list of partials will result in the string ""abcd"".

[ResxJSON.Partial.value("a"), ResxJSON.Partial.value(["b", "c"]), ResxJSON.Partial.value("d", :end)] #=> ""abcd""
Link to this function

value(data, atom)