class Cruml::Entities::ClassInfo

Overview

This consists of obtaining information about the reflected class.

Defined in:

entities/class_info.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(name : String, type : Symbol) #

The name and type of a class will be passed as arguments. A list of instance variables, inherited classes and methods are empty when the Cruml::Entities::ClassInfo class is instantiated.

Cruml::Entities::ClassInfo.new("Person", :class)

[View source]

Instance Method Detail

def add_inherit_class(parent_class_name : String, inherit_class_name : String) : Nil #

Adds a inherited class into a list of inherited classes.

class_info = Cruml::Entities::ClassInfo.new("Person", :class)
class_info.add_inherit_class("Person", "Employee")

[View source]
def add_instance_var(name : String, type : String) : Nil #

Adds the name and the type of a instance variable into the instance vars array.

class_info = Cruml::Entities::ClassInfo.new("Person", :class)
class_info.add_instance_var("first_name", "String")

[View source]
def add_method(method : Cruml::Entities::MethodInfo) : Nil #

Adds a method into a list of methods. INFO: The special initialize method will be placed at the first element of the list.

class_info = Cruml::Entities::ClassInfo.new("Person", :class)
method_info = Cruml::Entities::MethodInfo.new(:public, "major?", "Bool")
class_info.add_method(method_info)

[View source]
def inherit_classes : Array(Tuple(String, String, Symbol)) #

A list of inherited classes.


[View source]
def instance_vars : Array(Tuple(String, String)) #

A list of instance variables.


[View source]
def methods : Array(Cruml::Entities::MethodInfo) #

A list of methods.


[View source]
def name : String #

Name of a class.


[View source]
def type : Symbol #

Type of a class. This latter can be set as :class, :abstract or :interface.


[View source]