struct Amper::ObjectTree

Overview

An ObjectTree contains the parsed information of a JSON file, and provides the methods needed to generate the class, test, and spec files.

Defined in:

amper/object_tree.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(name : String, json : JSON::Any) #

Initializes an ObjectTree from a JSON::Any object.


Instance Method Detail

def name : String #

def raw(*args, **options) #

def raw(*args, **options, &) #

def to_class : CGT::Class #

Generates a Crystal class that can be deserialized from JSON files with the same structure as that used to generate self.


def to_class_file : String #

Generates a Crystal file with a class that can be deserialized from JSON files with the same structure as that used to generate self.


def to_test_file(json_file_path : String) : String #

Generates a file with unit tests for the generated class from #to_class, based on the minitest.cr framework.