Created
August 21, 2020 19:57
-
-
Save alxlion/3de90db3a000a82ea4f3787f5f51b4a0 to your computer and use it in GitHub Desktop.
Respond_to Metaprogramming example 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s = Shipment.new | |
if s.respond_to?(:cancel_shipping) | |
s.cancel_shipping | |
else | |
puts "Oh no ! Shipment cannot be cancel." | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment