Mega Code Archive

 
Categories / Ruby / Class
 

Extends a frozen class

class MyClass   def my_method     puts "This is the only method allowed in MyClass."   end   MyClass.freeze end class MySubclass < MyClass   def my_method     "This is only one of the methods available in MySubclass."   end   def my_other_method     "This is the other one."   end end MySubclass.new.my_method