Check out example codes for "how to create a method ruby". It will help you in understanding the concepts better.

Code Example 1

#start with 'def', name the method, add function, end with 'end'
def this_method_multiples_x_by_number_of_students
  x * number_of_students
end
# => class_name.this_method_multiples_x_by_number_of_students

Learn ReactJs, React Native from akashmittal.com