class Octopus @@octo_var = 2 # class variable TENTACLES = 8 # constant def initialize(n) @name = n end def speak puts "I'm an octopus named #{@name}" puts private_method end def print_vars puts @@octo_var puts TENTACLES end # this is the standard way to write a class method in Ruby def self.classgreeting puts "hi from class Octopus" end def self.otherclassgreeting puts "another hello" end private def private_method "calling a private method in Octopus" end end # to try: # o = Octopus.new("oscar") # o.speak # o.print_vars # Octopus.classgreeting