Often heard about the Open/Closed principal that says a class should be Open for extension and Closed for modification. Sounds great at the abstract level.
But is there any real-world use-cased example applied in the Ruby OOP land?
Ruby classes are all open. There is no closed class.
Example:
class String
def foo
puts "bar"
end
end
'anything'.foo
#bar
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With