I want to extend the Date class in ruby. In fact, what I want to do is add a method to the Date class. Below is an example
I want to add the 'my_simple_method' method to the Date class
def my_simple_method
puts 'this is from my_simple_method'
end
after adding these users should be able to call this method as
date_obj = Date.parse('2010-07-01')
puts date_obj.my_simple_method
should print 'this from my_simple_method'
early
amuses
Sameera
source
share