class Cruml::Entities::ClassInfo
- Cruml::Entities::ClassInfo
- Reference
- Object
Overview
This consists of obtaining information about the reflected class.
Defined in:
entities/class_info.crConstructors
-
.new(name : String, type : Symbol)
The name and type of a class will be passed as arguments.
Instance Method Summary
-
#add_inherit_class(parent_class_name : String, inherit_class_name : String) : Nil
Adds a inherited class into a list of inherited classes.
-
#add_instance_var(name : String, type : String) : Nil
Adds the name and the type of a instance variable into the instance vars array.
-
#add_method(method : Cruml::Entities::MethodInfo) : Nil
Adds a method into a list of methods.
-
#inherit_classes : Array(Tuple(String, String, Symbol))
A list of inherited classes.
-
#instance_vars : Array(Tuple(String, String))
A list of instance variables.
-
#methods : Array(Cruml::Entities::MethodInfo)
A list of methods.
-
#name : String
Name of a class.
-
#type : Symbol
Type of a class.
Constructor Detail
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)
Instance Method Detail
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")
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")
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)