-
Notifications
You must be signed in to change notification settings - Fork 1
Example: Class Methods
Andrias Meisyal edited this page Oct 20, 2016
·
4 revisions
A class has also some methods. A method of a class has responsibility for processing a single task.
For example, this picture below shows methods of Circle class.
If you generate Ruby code with this extension, this extension will create a .rb file as well. The generated code of class methods is shown as follows:
circle.rb
class Circle
def initialize()
end
def getRadius
# TODO(person name): Implement this method here.
end
def getArea
# TODO(person name): Implement this method here.
end
def to_s
"Your string representation of the object will be written here."
end
endUsing default configuration, the extension generates methods; constructor and a to string instance methods as well. The methods will also be grouped by theirs visibility.
