June 2017
Beginner
330 pages
7h 30m
English
For this example, we will have an Invoice class. Inside the class definition, we have attributes, such as a customer and total, along with some behavior, such as printing out an invoice summary:
class Invoice attr_accessor:customer, :total def summary puts "Invoice:" puts "Customer: #{customer}" puts "Total: #{total}" endend
Read now
Unlock full access