refs CNVS-7597
I could not find any instances of as_json being called directly (i.e.
not by to_json or the recursion in as_json). I could not find any
existing instances of nested OpenObjects (i.e. to trigger the recursion
in as_json). And it appears to me that we'd want the same object_type
"scoping" that to_json was doing even in a nested OpenObject#as_json. So
I move the object_type scoping from to_json to as_json; at this point,
to_json matched Object#to_json, and could be removed.
I introduce OpenStruct#as_json for consistency and to get rid of the
bare calls to OpenStruct#table in OpenObject#as_json.
With the recent change to Time#as_json, that branch in as_json can also
be simplified to value.as_json.
But the as_json calls on the subobjects are unnecessary; when the result
of the top-level as_json is json-encoded (through to_json), each element
will go through the appropriate ->as_json->to_json transformations as
well. So the .as_json calls can be dropped, and as_json (modulo the
object_type scoping) just becomes a call to table -- which is the
superclass' as_json. Handy!
test-plan: N/A
Change-Id: I783f1d3fbdcc6d71518c5f0f2d60a1faecc0c2fb
Reviewed-on: https://gerrit.instructure.com/23646
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
test plan:
* existing specs should pass; no user visible changes
* test particularly around dashboard stream items and grade summary pages
Change-Id: I81f82010df75bb104741fd325e85ca459dd9cfde
Reviewed-on: https://gerrit.instructure.com/13923
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>