!Mac OS X-10.15.7!ruby-2.7.2p137
hello class
Chart type ruby-VI (hello class)
Create class
Classify assert \ _equal and Monkey Patch to Integer
#!/usr/bin/env ruby
# frozen_string_literal: true
class Integer
def assert_equal(target)
if self == target
puts true
else
puts false
end
end
end
puts 3.assert_equal 3
output
> ruby assert_equal.rb
true
NOTE
--It seems that class overwriting is called monkey patching. --Use class to make the code easier to read --Become object-oriented