end ! class Person prepend Awesome def greet "hi!" end end ! puts Person.new.greet #=> awesome hi! w ܧঝͷઌ಄ʹૠ͠ࠐΊΔػೳ ! w JODMVEF"XFTPNF w 1FSTPO"XFTPNF w QSFQFOE"XFTPNF w "XFTPNF1FSTPO ! w 3*1BMJBT@NFUIPE@DIBJO
"!" end end end ! class Person using Bangable ! def greet(name) puts "Hi #{name}".! end end ! Person.new.greet("cat") #=> Hi cat! ! puts "Hi dog".! #=> false w &YQFSJNFOUBM͕औΕͨʂ ! w ΫϥεϞδϡʔϧͷε ίʔϓʹ༗ޮʹ w FWBMͷରԠೖΒͳ ͔ͬͨ
initialize(age) @age = age end ! def <=>(other) self.age <=> other.age end end ! a = Person.new(20) b = Person.new(18) ! p a > b #=> true ! p a == nil #=> warning: Comparable#== will no more rescue exceptions of #<=> in the next release. #=> warning: Return nil in #<=> if the comparison is inappropriate or avoid such comparison. #=> false ࣍ͷόʔδϣϯ͔Βͷྫ֎ΛӅṭͯ͘͠Εͳ͘ͳΓ·͢ɻ