-
Notifications
You must be signed in to change notification settings - Fork 1
Example: Empty Class
Andrias Meisyal edited this page Oct 20, 2016
·
3 revisions
An empty class is class that doesn't have attributes and methods. It just has a class name.
For example, this picture below shows empty classes. They are Author
and Book
classes.
If you generate Ruby code with this extension, this extension will create two separated .rb
files that contain Ruby code of those classes. The separated file will have name class_name.rb
. File name refers to the class name. So, the generated code of empty classes above is shown as follows:
author.rb
class Author
def initialize()
end
def to_s
"Your string representation of the object will be written here."
end
end
book.rb
class Book
def initialize()
end
def to_s
"Your string representation of the object will be written here."
end
end
The generated code uses default configuration of the extension. By default, the generated code of empty classes generates constructor and a to string instance methods.